From e68e92bcbdc54d0e9a874829b91c10de17e82b95 Mon Sep 17 00:00:00 2001 From: Jorge Barroso Barea Date: Wed, 5 Apr 2023 13:45:28 +0000 Subject: [PATCH] kcms: Move footer actions to headers This yields a more modern appearance and consistency with other KCMs that have already adopted this style. --- .../decoration/package/contents/ui/main.qml | 89 +++++++++---------- src/kcms/decoration/utils.cpp | 18 ++-- 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/src/kcms/decoration/package/contents/ui/main.qml b/src/kcms/decoration/package/contents/ui/main.qml index b2f0d82c0e..5a83977208 100644 --- a/src/kcms/decoration/package/contents/ui/main.qml +++ b/src/kcms/decoration/package/contents/ui/main.qml @@ -23,55 +23,54 @@ KCM.AbstractKCM { implicitWidth: Kirigami.Units.gridUnit * 48 implicitHeight: Kirigami.Units.gridUnit * 33 - Themes { - id: themes - - anchors.fill: parent - - - KCM.SettingStateBinding { - target: themes - configObject: kcm.settings - settingName: "pluginName" - } - } - - footer: RowLayout { - QQC2.Label { - text: i18nc("Selector label", "Window border size:") - } - - QQC2.ComboBox { + actions: [ + Kirigami.Action { id: borderSizeComboBox - model: kcm.borderSizesModel - currentIndex: kcm.borderIndex - onActivated: kcm.borderIndex = currentIndex; - KCM.SettingHighlighter { - highlight: kcm.borderIndex !== 0 - } - } + text: i18nc("Selector label", "Window border size:") - Kirigami.ActionToolBar { - flat: false - alignment: Qt.AlignRight - actions: [ - Kirigami.Action { - text: i18nc("button text", "Configure Titlebar Buttons…") - icon.name: "configure" - onTriggered: kcm.push("ConfigureTitlebar.qml") - }, - NewStuff.Action { - text: i18nc("button text", "Get New Window Decorations…") - configFile: "window-decorations.knsrc" - onEntryEvent: (entry, event) => { - if (event === NewStuff.Engine.StatusChangedEvent) { - kcm.reloadKWinSettings(); - } else if (event === NewStuff.Engine.EntryAdoptedEvent) { - kcm.load(); - } + displayComponent: RowLayout { + QQC2.ComboBox { + id: borderSizeComboBox + currentIndex: kcm.borderIndex + flat: true + model: kcm.borderSizesModel + + onActivated: kcm.borderIndex = currentIndex + + KCM.SettingHighlighter { + highlight: kcm.borderIndex !== 0 } } - ] + } + }, + Kirigami.Action { + icon.name: "configure" + text: i18nc("button text", "Configure Titlebar Buttons…") + + onTriggered: kcm.push("ConfigureTitlebar.qml") + }, + NewStuff.Action { + configFile: "window-decorations.knsrc" + text: i18nc("@action:button as in, \"Get New Window Decorations\"", "Get New…") + + onEntryEvent: (entry, event) => { + if (event === NewStuff.Engine.StatusChangedEvent) { + kcm.reloadKWinSettings(); + } else if (event === NewStuff.Engine.EntryAdoptedEvent) { + kcm.load(); + } + } + } + ] + + Themes { + id: themes + anchors.fill: parent + + KCM.SettingStateBinding { + configObject: kcm.settings + settingName: "pluginName" + target: themes } } } diff --git a/src/kcms/decoration/utils.cpp b/src/kcms/decoration/utils.cpp index ca00796d66..176d6fe8cd 100644 --- a/src/kcms/decoration/utils.cpp +++ b/src/kcms/decoration/utils.cpp @@ -22,15 +22,15 @@ const QMap s_borderSizes{ {QStringLiteral("VeryHuge"), KDecoration2::BorderSize::VeryHuge}, {QStringLiteral("Oversized"), KDecoration2::BorderSize::Oversized}}; const QMap s_borderSizeNames{ - {KDecoration2::BorderSize::None, i18n("No Borders")}, - {KDecoration2::BorderSize::NoSides, i18n("No Side Borders")}, - {KDecoration2::BorderSize::Tiny, i18n("Tiny")}, - {KDecoration2::BorderSize::Normal, i18n("Normal")}, - {KDecoration2::BorderSize::Large, i18n("Large")}, - {KDecoration2::BorderSize::VeryLarge, i18n("Very Large")}, - {KDecoration2::BorderSize::Huge, i18n("Huge")}, - {KDecoration2::BorderSize::VeryHuge, i18n("Very Huge")}, - {KDecoration2::BorderSize::Oversized, i18n("Oversized")}}; + {KDecoration2::BorderSize::None, i18n("No Window Borders")}, + {KDecoration2::BorderSize::NoSides, i18n("No Side Window Borders")}, + {KDecoration2::BorderSize::Tiny, i18n("Tiny Window Borders")}, + {KDecoration2::BorderSize::Normal, i18n("Normal Window Borders")}, + {KDecoration2::BorderSize::Large, i18n("Large Window Borders")}, + {KDecoration2::BorderSize::VeryLarge, i18n("Very Large Window Borders")}, + {KDecoration2::BorderSize::Huge, i18n("Huge Window Borders")}, + {KDecoration2::BorderSize::VeryHuge, i18n("Very Huge Window Borders")}, + {KDecoration2::BorderSize::Oversized, i18n("Oversized Window Borders")}}; const QHash s_buttonNames{ {KDecoration2::DecorationButtonType::Menu, QChar('M')},