[kcm/kwinrules] Fix Placement setting

Summary:
Since the port to KConfigXT, the setting "placement" is stored using the enum value, instead of a string equivalent.
This updates the kcm model to be able to communicate this property with the config schema.

BUG: 421586
FIXED-IN: 5.19.0

Test Plan:
- In a rule set the "Initial Placement" property
- The value is stored in `~/.config/kwinrulesrc`
- Close/reopen the kcm. The placement value is correctly loaded.

Reviewers: #kwin, #plasma, zzag

Reviewed By: #kwin, #plasma, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29790
This commit is contained in:
Ismael Asensio 2020-05-16 01:02:46 +02:00
parent db7fb26eed
commit fdd9ed53d9

View file

@ -740,18 +740,17 @@ QList<OptionsModel::Data> RulesModel::activitiesModelData() const
QList<OptionsModel::Data> RulesModel::placementModelData() const
{
// From "placement.h" : Placement rule is stored as a string, not the enum value
static const auto modelData = QList<OptionsModel::Data> {
{ Placement::policyToString(Placement::Default), i18n("Default") },
{ Placement::policyToString(Placement::NoPlacement), i18n("No Placement") },
{ Placement::policyToString(Placement::Smart), i18n("Minimal Overlapping") },
{ Placement::policyToString(Placement::Maximizing), i18n("Maximized") },
{ Placement::policyToString(Placement::Cascade), i18n("Cascaded") },
{ Placement::policyToString(Placement::Centered), i18n("Centered") },
{ Placement::policyToString(Placement::Random), i18n("Random") },
{ Placement::policyToString(Placement::ZeroCornered), i18n("In Top-Left Corner") },
{ Placement::policyToString(Placement::UnderMouse), i18n("Under Mouse") },
{ Placement::policyToString(Placement::OnMainWindow), i18n("On Main Window") }
{ Placement::Default, i18n("Default") },
{ Placement::NoPlacement, i18n("No Placement") },
{ Placement::Smart, i18n("Minimal Overlapping") },
{ Placement::Maximizing, i18n("Maximized") },
{ Placement::Cascade, i18n("Cascaded") },
{ Placement::Centered, i18n("Centered") },
{ Placement::Random, i18n("Random") },
{ Placement::ZeroCornered, i18n("In Top-Left Corner") },
{ Placement::UnderMouse, i18n("Under Mouse") },
{ Placement::OnMainWindow, i18n("On Main Window") }
};
return modelData;
}