From 0c727237eeed85dccc3911d664c36124e9212349 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 8 Aug 2025 13:30:57 +0200 Subject: [PATCH] Remove Edit menu This menu providers a few text editing related functions, like undo/redo, copy, paste, etc. As far as I can tell, it never worked in a useful way, though: It operates on the activeFocusItem, but as soon as one clicks on the menu, this becomes null. It is somewhat useable through shortcuts, but the text fields have these shortcuts natively. --- src/app/CMakeLists.txt | 1 - src/app/qml/EditMenu.qml | 86 -------------------------------------- src/app/qml/GlobalMenu.qml | 5 +-- 3 files changed, 1 insertion(+), 91 deletions(-) delete mode 100644 src/app/qml/EditMenu.qml diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index b2e681cdc..d9b8f31c1 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -122,7 +122,6 @@ if(NOT ANDROID AND NOT WIN32) qt_target_qml_sources(neochat QML_FILES qml/ShareAction.qml qml/GlobalMenu.qml - qml/EditMenu.qml ) else() qt_target_qml_sources(neochat QML_FILES diff --git a/src/app/qml/EditMenu.qml b/src/app/qml/EditMenu.qml deleted file mode 100644 index a63334898..000000000 --- a/src/app/qml/EditMenu.qml +++ /dev/null @@ -1,86 +0,0 @@ -// SPDX-FileCopyrightText: 2021 Carson Black -// SPDX-License-Identifier: LGPL-2.0-or-later - -import Qt.labs.platform as Labs -import QtQuick -import QtQuick.Layouts - -Labs.Menu { - id: root - - required property Item field - - Labs.MenuItem { - enabled: root.field !== null && root.field.canUndo - text: i18nc("text editing menu action", "Undo") - shortcut: StandardKey.Undo - onTriggered: { - root.field.undo(); - root.close(); - } - } - - Labs.MenuItem { - enabled: root.field !== null && root.field.canRedo - text: i18nc("text editing menu action", "Redo") - shortcut: StandardKey.Redo - onTriggered: { - root.field.undo(); - root.close(); - } - } - - Labs.MenuSeparator {} - - Labs.MenuItem { - enabled: root.field !== null && root.field.selectedText - text: i18nc("text editing menu action", "Cut") - shortcut: StandardKey.Cut - onTriggered: { - root.field.cut(); - root.close(); - } - } - - Labs.MenuItem { - enabled: root.field !== null && root.field.selectedText - text: i18nc("text editing menu action", "Copy") - shortcut: StandardKey.Copy - onTriggered: { - root.field.copy(); - root.close(); - } - } - - Labs.MenuItem { - enabled: root.field !== null && root.field.canPaste - text: i18nc("text editing menu action", "Paste") - shortcut: StandardKey.Paste - onTriggered: { - root.field.paste(); - root.close(); - } - } - - Labs.MenuItem { - enabled: root.field !== null && root.field.selectedText !== "" - text: i18nc("text editing menu action", "Delete") - shortcut: "" - onTriggered: { - root.field.remove(root.field.selectionStart, root.field.selectionEnd); - root.close(); - } - } - - Labs.MenuSeparator {} - - Labs.MenuItem { - enabled: root.field !== null - text: i18nc("text editing menu action", "Select All") - shortcut: StandardKey.SelectAll - onTriggered: { - root.field.selectAll(); - root.close(); - } - } -} diff --git a/src/app/qml/GlobalMenu.qml b/src/app/qml/GlobalMenu.qml index 54bf0fd78..90fda4b08 100644 --- a/src/app/qml/GlobalMenu.qml +++ b/src/app/qml/GlobalMenu.qml @@ -71,10 +71,7 @@ Labs.MenuBar { onTriggered: Qt.quit() } } - EditMenu { - title: i18nc("menu", "Edit") - field: (root.activeFocusItem instanceof TextEdit || root.activeFocusItem instanceof TextInput) ? root.activeFocusItem : null - } + Labs.Menu { title: i18nc("menu", "View")