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 
0036     Labs.MenuItem {
0037         enabled: root.field !== null && root.field.selectedText
0038         text: i18nc("text editing menu action", "Cut")
0039         shortcut: StandardKey.Cut
0040         onTriggered: {
0041             root.field.cut()
0042             root.close()
0043         }
0044     }
0045 
0046     Labs.MenuItem {
0047         enabled: root.field !== null && root.field.selectedText
0048         text: i18nc("text editing menu action", "Copy")
0049         shortcut: StandardKey.Copy
0050         onTriggered: {
0051             root.field.copy()
0052             root.close()
0053         }
0054     }
0055 
0056     Labs.MenuItem {
0057         enabled: root.field !== null && root.field.canPaste
0058         text: i18nc("text editing menu action", "Paste")
0059         shortcut: StandardKey.Paste
0060         onTriggered: {
0061             root.field.paste()
0062             root.close()
0063         }
0064     }
0065 
0066     Labs.MenuItem {
0067         enabled: root.field !== null && root.field.selectedText !== ""
0068         text: i18nc("text editing menu action", "Delete")
0069         shortcut: ""
0070         onTriggered: {
0071             root.field.remove(root.field.selectionStart, root.field.selectionEnd)
0072             root.close()
0073         }
0074     }
0075 
0076     Labs.MenuSeparator {
0077     }
0078 
0079     Labs.MenuItem {
0080         enabled: root.field !== null
0081         text: i18nc("text editing menu action", "Select All")
0082         shortcut: StandardKey.SelectAll
0083         onTriggered: {
0084             root.field.selectAll()
0085             root.close()
0086         }
0087     }
0088 }