kcms: Move footer actions to headers

This yields a more modern appearance and consistency with other KCMs
that have already adopted this style.
This commit is contained in:
Jorge Barroso Barea 2023-04-05 13:45:28 +00:00 committed by Nate Graham
parent 575831a331
commit e68e92bcbd
2 changed files with 53 additions and 54 deletions

View file

@ -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
}
}
}

View file

@ -22,15 +22,15 @@ const QMap<QString, KDecoration2::BorderSize> s_borderSizes{
{QStringLiteral("VeryHuge"), KDecoration2::BorderSize::VeryHuge},
{QStringLiteral("Oversized"), KDecoration2::BorderSize::Oversized}};
const QMap<KDecoration2::BorderSize, QString> 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<KDecoration2::DecorationButtonType, QChar> s_buttonNames{
{KDecoration2::DecorationButtonType::Menu, QChar('M')},