TrayFolderListItem.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2023 by Oleksandr Zolotov <alex@nextcloud.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. import QtQml 2.15
  15. import QtQuick 2.15
  16. import QtQuick.Controls 2.15
  17. import QtQuick.Layouts 1.15
  18. import Style 1.0
  19. MenuItem {
  20. id: root
  21. property string subline: ""
  22. property string iconSource: "image://svgimage-custom-color/folder-group.svg/" + Style.ncTextColor
  23. property string toolTipText: root.text
  24. NCToolTip {
  25. visible: root.hovered && root.toolTipText !== ""
  26. text: root.toolTipText
  27. }
  28. background: Item {
  29. height: parent.height
  30. width: parent.width
  31. Rectangle {
  32. anchors.fill: parent
  33. anchors.margins: Style.normalBorderWidth
  34. color: parent.parent.hovered || parent.parent.visualFocus ? Style.lightHover : "transparent"
  35. }
  36. }
  37. contentItem: RowLayout {
  38. anchors.fill: parent
  39. anchors.leftMargin: Style.trayWindowMenuEntriesMargin
  40. anchors.rightMargin: Style.trayWindowMenuEntriesMargin
  41. spacing: Style.trayHorizontalMargin
  42. Image {
  43. source: root.iconSource
  44. cache: true
  45. sourceSize.width: root.height * Style.smallIconScaleFactor
  46. sourceSize.height: root.height * Style.smallIconScaleFactor
  47. verticalAlignment: Qt.AlignVCenter
  48. horizontalAlignment: Qt.AlignHCenter
  49. Layout.preferredHeight: root.height * Style.smallIconScaleFactor
  50. Layout.preferredWidth: root.height * Style.smallIconScaleFactor
  51. Layout.alignment: Qt.AlignVCenter
  52. }
  53. ListItemLineAndSubline {
  54. lineText: root.text
  55. sublineText: root.subline
  56. spacing: Style.extraSmallSpacing
  57. Layout.fillWidth: true
  58. }
  59. }
  60. }