Warning, /network/neochat/src/qml/EditMenu.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Carson Black <uhhadd@gmail.com>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 import Qt.labs.platform as Labs
0005 import QtQuick
0006 import QtQuick.Layouts
0007 
0008 Labs.Menu {
0009     id: root
0010 
0011     required property Item field
0012 
0013     Labs.MenuItem {
0014         enabled: root.field !== null && root.field.canUndo
0015         text: i18nc("text editing menu action", "Undo")
0016         shortcut: StandardKey.Undo
0017         onTriggered: {
0018             root.field.undo();
0019             root.close();
0020         }
0021     }
0022 
0023     Labs.MenuItem {
0024         enabled: root.field !== null && root.field.canRedo
0025         text: i18nc("text editing menu action", "Redo")
0026         shortcut: StandardKey.Redo
0027         onTriggered: {
0028             root.field.undo();
0029             root.close();
0030         }
0031     }
0032 
0033     Labs.MenuSeparator {}
0034 
0035     Labs.MenuItem {
0036         enabled: root.field !== null && root.field.selectedText
0037         text: i18nc("text editing menu action", "Cut")
0038         shortcut: StandardKey.Cut
0039         onTriggered: {
0040             root.field.cut();
0041             root.close();
0042         }
0043     }
0044 
0045     Labs.MenuItem {
0046         enabled: root.field !== null && root.field.selectedText
0047         text: i18nc("text editing menu action", "Copy")
0048         shortcut: StandardKey.Copy
0049         onTriggered: {
0050             root.field.copy();
0051             root.close();
0052         }
0053     }
0054 
0055     Labs.MenuItem {
0056         enabled: root.field !== null && root.field.canPaste
0057         text: i18nc("text editing menu action", "Paste")
0058         shortcut: StandardKey.Paste
0059         onTriggered: {
0060             root.field.paste();
0061             root.close();
0062         }
0063     }
0064 
0065     Labs.MenuItem {
0066         enabled: root.field !== null && root.field.selectedText !== ""
0067         text: i18nc("text editing menu action", "Delete")
0068         shortcut: ""
0069         onTriggered: {
0070             root.field.remove(root.field.selectionStart, root.field.selectionEnd);
0071             root.close();
0072         }
0073     }
0074 
0075     Labs.MenuSeparator {}
0076 
0077     Labs.MenuItem {
0078         enabled: root.field !== null
0079         text: i18nc("text editing menu action", "Select All")
0080         shortcut: StandardKey.SelectAll
0081         onTriggered: {
0082             root.field.selectAll();
0083             root.close();
0084         }
0085     }
0086 }