You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
plasma-workspace/2767.patch

52 lines
1.9 KiB

From 8cbc16f0925c75b569c39184a68595c54278e75a Mon Sep 17 00:00:00 2001
From: ivan tkachenko <me@ratijas.tk>
Date: Wed, 22 Mar 2023 22:30:44 +0600
Subject: [PATCH] sddm-theme: Populate keyboard layouts menu only on first show
Doing it synchronously can be very slow; seemingly scaling with the
number of items in the model.
https://bugzilla.redhat.com/show_bug.cgi?id=2179998
---
lookandfeel/sddm-theme/KeyboardButton.qml | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lookandfeel/sddm-theme/KeyboardButton.qml b/lookandfeel/sddm-theme/KeyboardButton.qml
index df8767dda4..ca2458b6d2 100644
--- a/lookandfeel/sddm-theme/KeyboardButton.qml
+++ b/lookandfeel/sddm-theme/KeyboardButton.qml
@@ -17,7 +17,7 @@ PlasmaComponents.ToolButton {
onCurrentIndexChanged: keyboard.currentLayout = currentIndex
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Keyboard Layout: %1", keyboard.layouts[currentIndex].longName)
- visible: menu.count > 1
+ visible: keyboard.layouts.length > 1
checkable: true
checked: menu.opened
@@ -36,13 +36,17 @@ PlasmaComponents.ToolButton {
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
PlasmaCore.ColorScope.inherit: false
- Instantiator {
- id: instantiator
- model: {
+ onAboutToShow: {
+ if (instantiator.model === null) {
let layouts = keyboard.layouts;
layouts.sort((a, b) => a.longName.localeCompare(b.longName));
- return layouts;
+ instantiator.model = layouts;
}
+ }
+
+ Instantiator {
+ id: instantiator
+ model: null
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
delegate: PlasmaComponents.MenuItem {
--
GitLab