fix: Fix list display issues and add double newlines to fortunes

- Fixed: List description now updates immediately when changed (no restart needed)
- Fixed: ComboBox now shows only description text (not 'list_name - description')
- Changed: All fortune entries now end with double newline (\n\n)
- Added: New function get_fortune_lists_descriptions_only() for ComboBox
- Updated: QML ComboBox uses textRole and item.list_name

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
darklithium
2026-06-05 00:40:57 +02:00
parent cc6c6db391
commit e0a8570139
11 changed files with 960 additions and 950 deletions
+8 -19
View File
@@ -285,14 +285,13 @@ MainView {
try {
// Spruchlisten ComboBox füllen
py.call("fortunecookie.get_current_fortune_list", [], function(currentFortuneList) {
py.call("fortunecookie.get_fortune_lists_with_description", [], function(lists) {
fortuneListCombo.model = lists;
py.call("fortunecookie.get_fortune_lists_descriptions_only", [], function(listObjects) {
fortuneListCombo.model = listObjects;
// Aktuelle Liste auswählen
for (var i = 0; i < fortuneListCombo.count; i++) {
var text = fortuneListCombo.textAt(i);
var listName = text.split(" - ")[0];
if (listName === currentFortuneList) {
var item = fortuneListCombo.itemAt(i);
if (item && item.list_name === currentFortuneList) {
fortuneListCombo.currentIndex = i;
break;
}
@@ -328,26 +327,16 @@ MainView {
id: fortuneListCombo
Layout.fillWidth: true
Layout.preferredHeight: units.gu(8)
textRole: "description"
onActivated: {
var newListFull = fortuneListCombo.currentText;
var newList = newListFull.split(" - ")[0];
var newListObj = fortuneListCombo.currentItem;
var newList = newListObj ? newListObj.list_name : "fortune";
py.call("fortunecookie.set_fortune_list", [newList], function() {
console.log("Spruchliste gewaehlt: " + newList);
reloadFortune();
// Aktualisiere die Anzeige im Hauptbildschirm
var descriptions = {
"fortune": "klassische Glückskeks-Sprüche",
"farmer wisdom": "Bauernweisheiten",
"UNfortune": "Wednesday-Style",
"sandman": "Sandmännchen",
"famous quotes": "Berühmte Zitate",
"idioms": "Redensarten aus aller Welt",
"vegan recipes": "Vegane Rezeptideen",
"budandterence": "Legendäre Bud Spencer und Terence Hill Sprüche",
"unicorn": "Einhorn Glückssprüche (die fast schon wehtun)"
};
root.currentFortuneListDescription = descriptions[newList] || newList;
root.currentFortuneListDescription = newListObj ? newListObj.description : "";
});
}
}