Warning, /office/klevernotes/src/contents/ui/sideBar/ContextMenu.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2023 Louis Schul <schul9louis@gmail.com>
0003
0004 import QtQuick 2.15
0005 import QtQuick.Controls 2.15 as Controls
0006
0007 import org.kde.Klever 1.0
0008
0009 import "qrc:/contents/ui/dialogs"
0010
0011 Controls.Menu {
0012 id: contextMenu
0013
0014 required property ActionBar actionBar
0015 required property TreeView treeView
0016
0017 property bool canDelete: false
0018
0019 Controls.MenuItem {
0020 text: i18nc("as in 'A note category'", "New category")
0021 icon.name: "journal-new"
0022
0023 onTriggered: {
0024 actionBar.createCategoryAction.triggered()
0025 }
0026 }
0027
0028 Controls.MenuItem {
0029 icon.name: "folder-new"
0030 text: i18nc("as in 'A note group'", "New group")
0031
0032 onTriggered: {
0033 actionBar.createGroupAction.triggered()
0034 }
0035 }
0036
0037 Controls.MenuItem {
0038 icon.name: "document-new"
0039 text: i18nc("as in 'A note'", "New note")
0040
0041 onTriggered: {
0042 actionBar.createNoteAction.triggered()
0043 }
0044 }
0045
0046 Controls.MenuItem {
0047 icon.name: "edit-rename"
0048 text: i18n("Rename")
0049
0050 onTriggered: {
0051 actionBar.renameAction.triggered()
0052 }
0053 }
0054
0055 Controls.MenuItem {
0056 icon.name: "user-trash-symbolic"
0057 text: i18n("Delete")
0058
0059 visible: contextMenu.canDelete
0060 onTriggered: {
0061 deleteConfirmationDialog.open()
0062 }
0063 }
0064
0065 DeleteConfirmationDialog {
0066 id: deleteConfirmationDialog
0067
0068 useCase: actionBar.currentClickedItem ? actionBar.currentClickedItem.useCase : ""
0069
0070 onAccepted: {
0071 treeView.model.removeFromTree(actionBar.currentModelIndex)
0072 }
0073 onClosed: {
0074 actionBar.useCurrentItem()
0075 }
0076 }
0077 }