Warning, /office/klevernotes/src/contents/ui/sideBar/TreeItem.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Marco Martin <notmart@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.1 0008 0009 import org.kde.kirigami 2.19 as Kirigami 0010 import org.kde.kirigamiaddons.delegates 1 as Delegates 0011 0012 Delegates.RoundedTreeDelegate { 0013 id: treeItem 0014 0015 required property string path 0016 required property string useCase 0017 required property string displayName 0018 required property string iconName 0019 required property bool wantExpand 0020 required property bool wantFocus 0021 0022 signal itemRightClicked 0023 0024 text: displayName 0025 icon.name: iconName 0026 highlighted: treeview.currentItem ? treeView.currentItem.path === path : false 0027 0028 background: Rectangle { // Forced to do it, without that, the first element is not using the correct Theme 0029 Kirigami.Theme.colorSet: Kirigami.Theme.Window 0030 Kirigami.Theme.inherit: false 0031 0032 radius: Kirigami.Units.smallSpacing 0033 0034 color: if (treeItem.highlighted || treeItem.checked || (treeItem.down && !treeItem.checked) || treeItem.visualFocus) { 0035 const highlight = Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.3); 0036 if (treeItem.hovered) { 0037 Kirigami.ColorUtils.tintWithAlpha(highlight, Kirigami.Theme.textColor, 0.10) 0038 } else { 0039 highlight 0040 } 0041 } else if (treeItem.hovered) { 0042 Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.10) 0043 } else { 0044 Kirigami.Theme.backgroundColor 0045 } 0046 0047 border { 0048 color: Kirigami.Theme.highlightColor 0049 width: treeItem.visualFocus || treeItem.activeFocus ? 1 : 0 0050 } 0051 0052 Behavior on color { 0053 ColorAnimation { 0054 duration: Kirigami.Units.shortDuration 0055 } 0056 } 0057 } 0058 0059 MouseArea { 0060 anchors.fill: parent 0061 enabled: !Kirigami.Settings.isMobile 0062 0063 acceptedButtons: Qt.LeftButton | Qt.RightButton 0064 0065 onClicked: function (mouse) { 0066 if (mouse.button === Qt.RightButton) { 0067 contextMenu.canDelete = !treeItem.path.endsWith("/.BaseCategory") 0068 contextMenu.popup() 0069 itemRightClicked() 0070 return 0071 } 0072 treeItem.clicked() 0073 } 0074 } 0075 }