Commit dcc831e9 authored by Nate Graham's avatar Nate Graham
Browse files

applets/kickoff: fix "ReferenceError: plasmoid is not defined" error

This error happened because KickoffListView was asking for metrics that
come from a KickoffListItem living in KickoffSingleton. However that
item needs access to a config property to determine its own size, and
singletons can't access per-applet config data, because they're shared
across all instances of the app.

This commit fixes the issue by moving the metrics object for the
variable-size list item from the singleton to the root item of the
applet instance.
parent ff9c8fe6
Pipeline #220079 passed with stage
in 5 minutes and 41 seconds
......@@ -123,6 +123,25 @@ Item {
visible: false
imagePath: plasmoid.formFactor === PlasmaCore.Types.Planar ? "widgets/background" : "dialogs/background"
}
// This is here rather than in the singleton with the other metrics items
// because the list delegate's height depends on a configuration setting
// and the singleton can't access those
readonly property real listDelegateHeight: listDelegate.height
KickoffListDelegate {
id: listDelegate
visible: false
enabled: false
model: null
index: -1
text: "asdf"
url: ""
decoration: "start-here-kde"
description: "asdf"
action: null
indicator: null
}
//END
Plasmoid.switchWidth: plasmoid.fullRepresentationItem ? plasmoid.fullRepresentationItem.Layout.minimumWidth : -1
......
......@@ -96,7 +96,7 @@ EmptyPage {
let h = KickoffSingleton.gridCellSize * 4
// If no grids are used, use the number of items that would fit in the grid height
if (plasmoid.configuration.favoritesDisplay != 0 && plasmoid.configuration.applicationsDisplay != 0) {
h = Math.floor(h / KickoffSingleton.listDelegateHeight) * KickoffSingleton.listDelegateHeight
h = Math.floor(h / plasmoid.rootItem.listDelegateHeight) * plasmoid.rootItem.listDelegateHeight
}
return h + topMargin + bottomMargin
}
......
......@@ -55,8 +55,6 @@ Item {
}
readonly property real gridCellSize: gridDelegate.implicitHeight
readonly property real listDelegateHeight: listDelegate.implicitHeight
readonly property real listDelegateContentHeight: listDelegate.implicitContentHeight
readonly property real compactListDelegateHeight: compactListDelegate.implicitHeight
readonly property real compactListDelegateContentHeight: compactListDelegate.implicitContentHeight
//END
......@@ -76,19 +74,6 @@ Item {
action: null
indicator: null
}
KickoffListDelegate {
id: listDelegate
visible: false
enabled: false
model: null
index: -1
text: "asdf"
url: ""
decoration: "start-here-kde"
description: "asdf"
action: null
indicator: null
}
KickoffListDelegate {
id: compactListDelegate
visible: false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment