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 implicitWidth: Kirigami.Units.gridUnit * 48
implicitHeight: Kirigami.Units.gridUnit * 33 implicitHeight: Kirigami.Units.gridUnit * 33
Themes { actions: [
id: themes Kirigami.Action {
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 {
id: borderSizeComboBox id: borderSizeComboBox
model: kcm.borderSizesModel text: i18nc("Selector label", "Window border size:")
currentIndex: kcm.borderIndex
onActivated: kcm.borderIndex = currentIndex;
KCM.SettingHighlighter {
highlight: kcm.borderIndex !== 0
}
}
Kirigami.ActionToolBar { displayComponent: RowLayout {
flat: false QQC2.ComboBox {
alignment: Qt.AlignRight id: borderSizeComboBox
actions: [ currentIndex: kcm.borderIndex
Kirigami.Action { flat: true
text: i18nc("button text", "Configure Titlebar Buttons…") model: kcm.borderSizesModel
icon.name: "configure"
onTriggered: kcm.push("ConfigureTitlebar.qml") onActivated: kcm.borderIndex = currentIndex
},
NewStuff.Action { KCM.SettingHighlighter {
text: i18nc("button text", "Get New Window Decorations…") highlight: kcm.borderIndex !== 0
configFile: "window-decorations.knsrc"
onEntryEvent: (entry, event) => {
if (event === NewStuff.Engine.StatusChangedEvent) {
kcm.reloadKWinSettings();
} else if (event === NewStuff.Engine.EntryAdoptedEvent) {
kcm.load();
}
} }
} }
] }
},
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("VeryHuge"), KDecoration2::BorderSize::VeryHuge},
{QStringLiteral("Oversized"), KDecoration2::BorderSize::Oversized}}; {QStringLiteral("Oversized"), KDecoration2::BorderSize::Oversized}};
const QMap<KDecoration2::BorderSize, QString> s_borderSizeNames{ const QMap<KDecoration2::BorderSize, QString> s_borderSizeNames{
{KDecoration2::BorderSize::None, i18n("No Borders")}, {KDecoration2::BorderSize::None, i18n("No Window Borders")},
{KDecoration2::BorderSize::NoSides, i18n("No Side Borders")}, {KDecoration2::BorderSize::NoSides, i18n("No Side Window Borders")},
{KDecoration2::BorderSize::Tiny, i18n("Tiny")}, {KDecoration2::BorderSize::Tiny, i18n("Tiny Window Borders")},
{KDecoration2::BorderSize::Normal, i18n("Normal")}, {KDecoration2::BorderSize::Normal, i18n("Normal Window Borders")},
{KDecoration2::BorderSize::Large, i18n("Large")}, {KDecoration2::BorderSize::Large, i18n("Large Window Borders")},
{KDecoration2::BorderSize::VeryLarge, i18n("Very Large")}, {KDecoration2::BorderSize::VeryLarge, i18n("Very Large Window Borders")},
{KDecoration2::BorderSize::Huge, i18n("Huge")}, {KDecoration2::BorderSize::Huge, i18n("Huge Window Borders")},
{KDecoration2::BorderSize::VeryHuge, i18n("Very Huge")}, {KDecoration2::BorderSize::VeryHuge, i18n("Very Huge Window Borders")},
{KDecoration2::BorderSize::Oversized, i18n("Oversized")}}; {KDecoration2::BorderSize::Oversized, i18n("Oversized Window Borders")}};
const QHash<KDecoration2::DecorationButtonType, QChar> s_buttonNames{ const QHash<KDecoration2::DecorationButtonType, QChar> s_buttonNames{
{KDecoration2::DecorationButtonType::Menu, QChar('M')}, {KDecoration2::DecorationButtonType::Menu, QChar('M')},