Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/utils.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 68 | { | |||
---|---|---|---|---|---|
75 | }; | 75 | }; | ||
76 | QString ret; | 76 | QString ret; | ||
77 | for (auto button : buttons) { | 77 | for (auto button : buttons) { | ||
78 | ret.append(buttonToString(button)); | 78 | ret.append(buttonToString(button)); | ||
79 | } | 79 | } | ||
80 | return ret; | 80 | return ret; | ||
81 | } | 81 | } | ||
82 | 82 | | |||
83 | DecorationButtonsList readDecorationButtons(const KConfigGroup &config, const QString &key, const DecorationButtonsList &defaultValue) | 83 | DecorationButtonsList buttonsFromString(const QString &buttons) | ||
84 | { | 84 | { | ||
85 | auto buttonsFromString = [](const QString &buttons) -> DecorationButtonsList { | | |||
86 | DecorationButtonsList ret; | 85 | DecorationButtonsList ret; | ||
87 | for (auto it = buttons.begin(); it != buttons.end(); ++it) { | 86 | for (auto it = buttons.begin(); it != buttons.end(); ++it) { | ||
88 | for (auto it2 = s_buttonNames.constBegin(); it2 != s_buttonNames.constEnd(); ++it2) { | 87 | for (auto it2 = s_buttonNames.constBegin(); it2 != s_buttonNames.constEnd(); ++it2) { | ||
89 | if (it2.value() == (*it)) { | 88 | if (it2.value() == (*it)) { | ||
90 | ret << it2.key(); | 89 | ret << it2.key(); | ||
91 | } | 90 | } | ||
92 | } | 91 | } | ||
93 | } | 92 | } | ||
94 | return ret; | 93 | return ret; | ||
95 | }; | 94 | } | ||
95 | | ||||
96 | DecorationButtonsList readDecorationButtons(const KConfigGroup &config, const QString &key, const DecorationButtonsList &defaultValue) | ||||
97 | { | ||||
96 | return buttonsFromString(config.readEntry(key, buttonsToString(defaultValue))); | 98 | return buttonsFromString(config.readEntry(key, buttonsToString(defaultValue))); | ||
97 | } | 99 | } | ||
98 | 100 | | |||
99 | KDecoration2::BorderSize stringToBorderSize(const QString &name) | 101 | KDecoration2::BorderSize stringToBorderSize(const QString &name) | ||
100 | { | 102 | { | ||
101 | auto it = s_borderSizes.constFind(name); | 103 | auto it = s_borderSizes.constFind(name); | ||
102 | if (it == s_borderSizes.constEnd()) { | 104 | if (it == s_borderSizes.constEnd()) { | ||
103 | // non sense values are interpreted just like normal | 105 | // non sense values are interpreted just like normal | ||
Show All 16 Lines |