diff --git a/src/settings/CMakeLists.txt b/src/settings/CMakeLists.txt index f41aeb69f..ac315edad 100644 --- a/src/settings/CMakeLists.txt +++ b/src/settings/CMakeLists.txt @@ -49,6 +49,7 @@ ecm_add_qml_module(Settings GENERATE_PLUGIN_SOURCE ExportKeysDialog.qml RoomSortParameterDialog.qml RoomProfile.qml + RoomAdvancedPage.qml SOURCES colorschemer.cpp threepidaddhelper.cpp diff --git a/src/settings/RoomAdvancedPage.qml b/src/settings/RoomAdvancedPage.qml new file mode 100644 index 000000000..58086ce9d --- /dev/null +++ b/src/settings/RoomAdvancedPage.qml @@ -0,0 +1,99 @@ +// SPDX-FileCopyrightText: 2021 Carl Schwan +// SPDX-FileCopyrightText: 2025 Joshua Goins +// SPDX-License-Identifier: GPL-3.0-only + +import QtQuick +import QtQuick.Controls as QQC2 +import QtQuick.Layouts +import QtQuick.Window + +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.formcard as FormCard +import org.kde.kirigamiaddons.labs.components as KirigamiComponents + +import org.kde.neochat + +FormCard.FormCardPage { + id: root + + property NeoChatRoom room + + title: i18nc("@window:title", "Advanced") + + FormCard.FormCard { + Layout.topMargin: Kirigami.Units.gridUnit + + FormCard.FormTextDelegate { + id: roomIdDelegate + text: i18nc("@info:label", "Room ID") + description: room.id + + contentItem.children: QQC2.Button { + visible: roomIdDelegate.hovered + text: i18nc("@action:button", "Copy room ID to clipboard") + icon.name: "edit-copy" + display: QQC2.AbstractButton.IconOnly + + onClicked: { + Clipboard.saveText(room.id); + } + + QQC2.ToolTip.text: text + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + QQC2.ToolTip.visible: hovered + } + } + FormCard.FormTextDelegate { + text: i18nc("@info:label", "Room Version") + description: room.version + + contentItem.children: QQC2.Button { + visible: room.canSwitchVersions() + enabled: room.version < room.maxRoomVersion + text: i18nc("@action:button", "Upgrade Room") + icon.name: "arrow-up-double" + + onClicked: { + if (room.canSwitchVersions()) { + roomUpgradeDialog.currentRoomVersion = room.version; + roomUpgradeDialog.open(); + } + } + + QQC2.ToolTip { + text: text + delay: Kirigami.Units.toolTipDelay + } + } + } + } + + property Kirigami.Dialog roomUpgradeDialog: Kirigami.Dialog { + id: roomUpgradeDialog + + property var currentRoomVersion + + width: Kirigami.Units.gridUnit * 16 + + title: i18nc("@title", "Upgrade the Room") + ColumnLayout { + FormCard.FormSpinBoxDelegate { + id: spinBox + label: i18nc("@label:spinbox", "Select new version") + from: room.version + to: room.maxRoomVersion + value: room.version + } + } + customFooterActions: [ + Kirigami.Action { + text: i18nc("@action:button", "Confirm") + icon.name: "dialog-ok" + onTriggered: { + room.switchVersion(spinBox.value); + roomUpgradeDialog.close(); + } + } + ] + } +} diff --git a/src/settings/RoomGeneralPage.qml b/src/settings/RoomGeneralPage.qml index 79626a43c..849fb9f00 100644 --- a/src/settings/RoomGeneralPage.qml +++ b/src/settings/RoomGeneralPage.qml @@ -97,54 +97,6 @@ FormCard.FormCardPage { } } - FormCard.FormCard { - Layout.topMargin: Kirigami.Units.gridUnit - - FormCard.FormTextDelegate { - id: roomIdDelegate - text: i18n("Room ID") - description: room.id - - contentItem.children: QQC2.Button { - visible: roomIdDelegate.hovered - text: i18n("Copy room ID to clipboard") - icon.name: "edit-copy" - display: QQC2.AbstractButton.IconOnly - - onClicked: { - Clipboard.saveText(room.id); - } - - QQC2.ToolTip.text: text - QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay - QQC2.ToolTip.visible: hovered - } - } - FormCard.FormTextDelegate { - text: i18n("Room version") - description: room.version - - contentItem.children: QQC2.Button { - visible: room.canSwitchVersions() - enabled: room.version < room.maxRoomVersion - text: i18n("Upgrade Room") - icon.name: "arrow-up-double" - - onClicked: { - if (room.canSwitchVersions()) { - roomUpgradeDialog.currentRoomVersion = room.version; - roomUpgradeDialog.open(); - } - } - - QQC2.ToolTip { - text: text - delay: Kirigami.Units.toolTipDelay - } - } - } - } - FormCard.FormHeader { title: i18n("Aliases") } @@ -402,33 +354,4 @@ FormCard.FormCardPage { parentWindow: root.Window.window } } - - property Kirigami.Dialog roomUpgradeDialog: Kirigami.Dialog { - id: roomUpgradeDialog - - property var currentRoomVersion - - width: Kirigami.Units.gridUnit * 16 - - title: i18n("Upgrade the Room") - ColumnLayout { - FormCard.FormSpinBoxDelegate { - id: spinBox - label: i18n("Select new version") - from: room.version - to: room.maxRoomVersion - value: room.version - } - } - customFooterActions: [ - Kirigami.Action { - text: i18n("Confirm") - icon.name: "dialog-ok" - onTriggered: { - room.switchVersion(spinBox.value); - roomUpgradeDialog.close(); - } - } - ] - } } diff --git a/src/settings/RoomSettingsView.qml b/src/settings/RoomSettingsView.qml index c072cccbe..ae735a82a 100644 --- a/src/settings/RoomSettingsView.qml +++ b/src/settings/RoomSettingsView.qml @@ -89,6 +89,17 @@ KirigamiSettings.ConfigurationView { room: root._room }; } + }, + KirigamiSettings.ConfigurationModule { + moduleId: "advanced" + text: i18nc("@title", "Advanced") + icon.name: "document-properties-symbolic" + page: () => Qt.createComponent("org.kde.neochat.settings", "RoomAdvancedPage") + initialProperties: () => { + return { + room: root._room + }; + } } ] }