From 882ead57152afa600661f1aae820003c21b7b28e Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Wed, 27 Mar 2024 22:34:40 +0100 Subject: [PATCH] Remove external room window feature At its best, this worked ok-ish, though it was always missing basic features. It's also a massive memory leak and significantly complicates the codebase. (Which is not yet cleaned up by this commit) Currently, it is entirely broken and noone noticed or cared enough to report or fix that. BUG: 455984 --- src/CMakeLists.txt | 1 - src/qml/ContextMenu.qml | 12 -------- src/qml/RoomWindow.qml | 64 ----------------------------------------- src/qml/main.qml | 14 --------- src/roommanager.cpp | 6 ---- src/roommanager.h | 7 ----- 6 files changed, 104 deletions(-) delete mode 100644 src/qml/RoomWindow.qml diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9b31b2544..9b53b8480 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -188,7 +188,6 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN qml/UserInfo.qml qml/UserInfoDesktop.qml qml/RoomPage.qml - qml/RoomWindow.qml qml/ExploreRoomsPage.qml qml/ManualRoomDialog.qml qml/ExplorerDelegate.qml diff --git a/src/qml/ContextMenu.qml b/src/qml/ContextMenu.qml index bf54da208..223f6810d 100644 --- a/src/qml/ContextMenu.qml +++ b/src/qml/ContextMenu.qml @@ -27,18 +27,6 @@ Loader { Component { id: regularMenu QQC2.Menu { - QQC2.MenuItem { - id: newWindow - text: i18n("Open in New Window") - icon.name: "window-new" - onTriggered: RoomManager.openWindow(room) - visible: !Kirigami.Settings.isMobile - } - - QQC2.MenuSeparator { - visible: newWindow.visible - } - QQC2.MenuItem { text: room.isFavourite ? i18n("Remove from Favorites") : i18n("Add to Favorites") icon.name: room.isFavourite ? "bookmark-remove" : "bookmark-new" diff --git a/src/qml/RoomWindow.qml b/src/qml/RoomWindow.qml deleted file mode 100644 index 7e07a5c00..000000000 --- a/src/qml/RoomWindow.qml +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-FileCopyrightText: 2020 Carl Schwan -// 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.neochat - -Kirigami.ApplicationWindow { - id: root - - required property NeoChatRoom currentRoom - required property NeoChatConnection connection - - minimumWidth: Kirigami.Units.gridUnit * 10 - minimumHeight: Kirigami.Units.gridUnit * 15 - - Shortcut { - sequence: StandardKey.Cancel - onActivated: root.close() - } - pageStack.initialPage: RoomPage { - id: roomPage - visible: true - currentRoom: root.currentRoom - disableCancelShortcut: true - connection: root.connection - - timelineModel: TimelineModel { - room: currentRoom - } - messageFilterModel: MessageFilterModel { - sourceModel: roomPage.messageEventModel - } - mediaMessageFilterModel: MediaMessageFilterModel { - sourceModel: roomPage.messageFilterModel - } - } - - onCurrentRoomChanged: if (!currentRoom) { - root.close(); - } - - property Item hoverLinkIndicator: QQC2.Control { - parent: overlay.parent - property string text - opacity: linkText.text.length > 0 ? 1 : 0 - - z: 20 - x: 0 - y: parent.height - implicitHeight - contentItem: QQC2.Label { - id: linkText - text: parent.text.startsWith("https://matrix.to/") ? "" : parent.text - } - Kirigami.Theme.colorSet: Kirigami.Theme.View - background: Rectangle { - color: Kirigami.Theme.backgroundColor - } - } -} diff --git a/src/qml/main.qml b/src/qml/main.qml index 44ebbbb4b..0cacf184f 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -186,15 +186,6 @@ Kirigami.ApplicationWindow { roomItem.forceActiveFocus(); } - function onOpenRoomInNewWindow(room) { - const secondaryWindow = roomWindow.createObject(undefined, { - currentRoom: room, - connection: root.connection - }); - secondaryWindow.width = root.width - pageStack.get(0).width; - secondaryWindow.show(); - } - function onAskDirectChatConfirmation(user) { askDirectChatConfirmationComponent.createObject(QQC2.ApplicationWindow.overlay, { user: user @@ -415,11 +406,6 @@ Kirigami.ApplicationWindow { } } - Component { - id: roomWindow - RoomWindow {} - } - Component { id: joinRoomDialog JoinRoomDialog {} diff --git a/src/roommanager.cpp b/src/roommanager.cpp index b36e184ae..75f8c37e0 100644 --- a/src/roommanager.cpp +++ b/src/roommanager.cpp @@ -250,12 +250,6 @@ void RoomManager::openRoomForActiveConnection() } } -void RoomManager::openWindow(NeoChatRoom *room) -{ - // forward the call to QML - Q_EMIT openRoomInNewWindow(room); -} - UriResolveResult RoomManager::visitUser(User *user, const QString &action) { if (action == "mention"_ls || action.isEmpty()) { diff --git a/src/roommanager.h b/src/roommanager.h index e2a965b0a..a19b4c1e3 100644 --- a/src/roommanager.h +++ b/src/roommanager.h @@ -148,13 +148,6 @@ public: */ Q_INVOKABLE void loadInitialRoom(); - /** - * @brief Open a new window with the given room. - * - * The open window will have its own message list for the given room. - */ - Q_INVOKABLE void openWindow(NeoChatRoom *room); - /** * @brief Leave the room and close it if it is open. */