From ba1d175d6776a1ff0bfd914e25a966bfec59fa9e Mon Sep 17 00:00:00 2001 From: Arno Rehn Date: Sat, 4 Oct 2025 15:06:23 +0200 Subject: [PATCH] Add "Extensions" item to the room info --- src/roominfo/CMakeLists.txt | 1 + src/roominfo/RoomInformation.qml | 16 +++++++++ src/roominfo/WidgetsPage.qml | 59 ++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/roominfo/WidgetsPage.qml diff --git a/src/roominfo/CMakeLists.txt b/src/roominfo/CMakeLists.txt index 8c7db900a..05ab239f4 100644 --- a/src/roominfo/CMakeLists.txt +++ b/src/roominfo/CMakeLists.txt @@ -14,6 +14,7 @@ ecm_add_qml_module(RoomInfo GENERATE_PLUGIN_SOURCE LocationsPage.qml RoomPinnedMessagesPage.qml RoomSearchPage.qml + WidgetsPage.qml SOURCES locationhelper.cpp ) diff --git a/src/roominfo/RoomInformation.qml b/src/roominfo/RoomInformation.qml index aaac17d3b..a69081c06 100644 --- a/src/roominfo/RoomInformation.qml +++ b/src/roominfo/RoomInformation.qml @@ -116,6 +116,22 @@ QQC2.ScrollView { Layout.fillWidth: true } + Delegates.RoundedItemDelegate { + id: widgetsButton + visible: !root.room.isSpace + icon.name: "extension-symbolic" + text: i18nc("@action:button", "Extensions for this room") + activeFocusOnTab: true + + onClicked: ((QQC2.ApplicationWindow.window as Kirigami.ApplicationWindow).pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'WidgetsPage'), { + room: root.room + }, { + title: i18nc("@title:window", "Extensions") + }) + + Layout.fillWidth: true + } + Delegates.RoundedItemDelegate { id: locationsButton visible: !root.room.isSpace diff --git a/src/roominfo/WidgetsPage.qml b/src/roominfo/WidgetsPage.qml new file mode 100644 index 000000000..ee013a583 --- /dev/null +++ b/src/roominfo/WidgetsPage.qml @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: 2025 Arno Rehn +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick +import QtQuick.Controls as QQC2 +import QtQuick.Layouts + +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.delegates as Delegates + +import org.kde.neochat.libneochat + +Kirigami.ScrollablePage { + id: root + + required property NeoChatRoom room + + title: i18nc("@title", "Extensions") + + ListView { + id: extView + visible: extView.count !== 0 + + currentIndex: -1 + + model: WidgetModel { + room: root.room + } + + delegate: Delegates.RoundedItemDelegate { + id: del + + required text + required property url url + required property string type + + // Can we actually use the jitsi logo without being infringing any + // trademarks? + icon.name: type === "jitsi" ? "meeting-attending" + : type === "m.etherpad" ? "document-share" + : "" + + contentItem: Delegates.SubtitleContentItem { + iconItem.visible: true + itemDelegate: del + subtitle: del.url + labelItem.textFormat: Text.PlainText + } + + onClicked: Qt.openUrlExternally(url) + } + } + + Kirigami.PlaceholderMessage { + text: i18nc("@info:placeholder", "There are no extensions in this room.") + visible: extView.count === 0 + anchors.centerIn: parent + } +}