Warning, /plasma/plasma-desktop/applets/kickoff/package/contents/ui/KickoffSingleton.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
0002  * SPDX-License-Identifier: LGPL-2.0-or-later
0003  */
0004 
0005 pragma Singleton // NOTE: Singletons are shared between all instances of a plasmoid
0006 
0007 import QtQml.Models 2.15
0008 import QtQuick 2.15
0009 import QtQuick.Templates 2.15 as T
0010 import QtQml 2.15
0011 import org.kde.kirigami 2.20 as Kirigami
0012 import org.kde.ksvg 1.0 as KSvg
0013 import org.kde.plasma.plasma5support 2.0 as P5Support
0014 
0015 // Using Item because it has a default property.
0016 // Trying to create a default property for a QtObject seems to cause segfaults.
0017 Item {
0018     id: root
0019     visible: false
0020 
0021     //BEGIN Models and Data Sources
0022     readonly property P5Support.DataSource powerManagement: P5Support.DataSource {
0023         engine: "powermanagement"
0024         connectedSources: ["PowerDevil"]
0025         // For some reason, these signal handlers need to be here for `data` to actually contain data.
0026         onSourceAdded: source => {
0027             disconnectSource(source);
0028             connectSource(source);
0029         }
0030         onSourceRemoved: source => disconnectSource(source);
0031     }
0032     //END
0033 
0034     //BEGIN Reusable Objects
0035     readonly property KSvg.Svg lineSvg: KSvg.Svg {
0036         imagePath: "widgets/line"
0037         property int horLineHeight: lineSvg.elementSize("horizontal-line").height
0038         property int vertLineWidth: lineSvg.elementSize("vertical-line").width
0039     }
0040     //END
0041 
0042     //BEGIN Metrics
0043     readonly property KSvg.FrameSvgItem listItemMetrics: KSvg.FrameSvgItem {
0044         visible: false
0045         imagePath: "widgets/listitem"
0046         prefix: "normal"
0047     }
0048 
0049     readonly property FontMetrics fontMetrics: FontMetrics {
0050         id: fontMetrics
0051         font: Kirigami.Theme.defaultFont
0052     }
0053 
0054     readonly property real gridCellSize: gridDelegate.implicitHeight
0055     readonly property real compactListDelegateHeight: compactListDelegate.implicitHeight
0056     readonly property real compactListDelegateContentHeight: compactListDelegate.implicitContentHeight
0057     //END
0058 
0059     //BEGIN Private
0060     KickoffGridDelegate {
0061         id: gridDelegate
0062         visible: false
0063         enabled: false
0064         model: null
0065         index: -1
0066         text: "asdf"
0067         url: ""
0068         decoration: "start-here-kde"
0069         description: "asdf"
0070         width: implicitHeight
0071         action: null
0072         indicator: null
0073     }
0074     KickoffListDelegate {
0075         id: compactListDelegate
0076         visible: false
0077         enabled: false
0078         compact: true
0079         model: null
0080         index: -1
0081         text: "asdf"
0082         url: ""
0083         decoration: "start-here-kde"
0084         description: "asdf"
0085         action: null
0086         indicator: null
0087     }
0088     //END
0089 }