File: upstream_f8532d35_applets-kickoff-recalculate-app-model-binding-on-rootModel-refresh.patch

package info (click to toggle)
plasma-desktop 4%3A6.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 61,044 kB
  • sloc: cpp: 37,691; ansic: 2,617; python: 1,386; javascript: 1,163; xml: 1,082; sh: 128; makefile: 16
file content (45 lines) | stat: -rw-r--r-- 2,021 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From f8532d35a782af807448fde581f3f7239c77b7d6 Mon Sep 17 00:00:00 2001
From: Christoph Wolk <cwo.kde@posteo.net>
Date: Wed, 28 May 2025 19:43:03 +0200
Subject: [PATCH] applets/kickoff: recalculate app model binding on rootModel
 refresh

Kickoff stores (a pointer to) the most recently accessed app category
(including the all-apps category, but not favorites) through a binding
chain fetching the rootModel's modelForRow() on the current index of the
sidebar. That's a method call that does not by itself create a qml
dependency on the main model state, so if the user installs or removes
software, the underlying model is replaced completely (and the existing
one is deleted), but the binding is not updated to point to the new
(sub)model. Accessing the same category again will then fail (as it
reads the old model, now null), until the user selects a different
category first, changing the index and causing the binding to be
reevaluated.

Instead, reevaluate the binding whenever the rootModel is refreshed.

BUG: 504891
---
 applets/kickoff/package/contents/ui/ApplicationsPage.qml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/applets/kickoff/package/contents/ui/ApplicationsPage.qml b/applets/kickoff/package/contents/ui/ApplicationsPage.qml
index 8c7f3f06f4..c2baa75b52 100644
--- a/applets/kickoff/package/contents/ui/ApplicationsPage.qml
+++ b/applets/kickoff/package/contents/ui/ApplicationsPage.qml
@@ -85,6 +85,12 @@ BasePage {
         // But to trigger model data update, set initial value to 0
         property int appsModelRow: 0
         readonly property Kicker.AppsModel appsModel: kickoff.rootModel.modelForRow(appsModelRow)
+        Connections {
+            target: kickoff.rootModel
+            function onRefreshed() { // recalculate appsModel binding on rootModel refresh;
+                stackView.appsModelRowChanged() // modelForRow does not create dependency
+            }
+        }
         focus: true
         initialItem: preferredFavoritesViewComponent
 
-- 
GitLab