<table><tr><td style="">ervin requested changes to this revision.<br />ervin added a comment.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D27682">View Revision</a></tr></table><br /><div><div><p>This needs some design changes I think. Also please update copyright headers in the files you touch and add them in the files you add.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156566">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettings.kcfg:442</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">  </group>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">  <group name="General">
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <entry name="count" type="int">
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Related to other comments I made, this feels like you should have two kcfg files, one with this trivial General group and one with the parameterized group. Since user code would likely poke one to know how many parameterized groups to look for. Otherwise it forces you to have two very distinct concepts living in the same class.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156550">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettings.kcfgc:1</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">File=rulesettings.kcfg
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">IncludeFiles=\"rules.h\",\"placement.h\",netwm_def.h
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Please rename the files to rulesettingsbase.kcfg and rulesettingsbase.kcfgc</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156551">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettings.kcfgc:4</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">NameSpace=KWin
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">ClassName=RuleSettings
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">UseEnumTypes=true
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Change to RuleSettingsBase</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156562">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettingsmanager.cpp:41</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #74777d">// If there are more rules than in cache</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">settings</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">RuleSettings</span><span class="p">(</span><span style="color: #aa4000">this</span><span style="color: #aa2211">-></span><span class="n">sharedConfig</span><span class="p">(),</span> <span class="n">QString</span><span style="color: #aa2211">::</span><span class="n">number</span><span class="p">(</span><span class="n">i</span><span class="p">),</span> <span style="color: #aa4000">this</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">m_list</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">settings</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">We don't do "this->"</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156563">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettingsmanager.cpp:51</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">for</span> <span class="p">(</span><span class="n">i</span> <span style="color: #aa2211">=</span> <span class="n">rules</span><span class="p">.</span><span class="n">length</span><span class="p">()</span> <span style="color: #aa2211">+</span> <span style="color: #601200">1</span><span class="p">;</span> <span class="n">i</span> <span style="color: #aa2211"><=</span> <span class="n">mCount</span><span class="p">;</span> <span class="n">i</span><span style="color: #aa2211">++</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">this</span><span style="color: #aa2211">-></span><span class="n">sharedConfig</span><span class="p">()</span><span style="color: #aa2211">-></span><span class="n">deleteGroup</span><span class="p">(</span><span class="n">QString</span><span style="color: #aa2211">::</span><span class="n">number</span><span class="p">(</span><span class="n">i</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Ditto</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156552">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettingsmanager.h:1</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #304a96">#ifndef RULESSETTINGSLIST_H</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #304a96">#define RULESSETTINGSLIST_H</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Looks like those include guards should be changed to match the filename, and please rename that to rulesettings.h (+ rulesettings.cpp) of course.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156553">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettingsmanager.h:4</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #304a96">#include</span> <span class="cpf">"rulesettings.h"</span><span style="color: #304a96"></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #304a96">#include</span> <span class="cpf"><KSharedConfig></span><span style="color: #304a96"></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Will become rulesettingsbase.h</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156554">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettingsmanager.h:10</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="n">class</span> <span class="n">Rules</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #74777d">// class RuleSettings;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Please remove this</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156556">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulesettingsmanager.h:12</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="n">class</span> <span style="color: #a0a000">RuleSettingsManager</span> <span class="p">:</span> <span class="n">public</span> <span class="n">RuleSettings</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Rename RuleSettingsManager to RuleSettings</p>

<p style="padding: 0; margin: 8px;">Note that I find this design looks odd (I suspect it tries to conflate two things which should perhaps be separated). So its a RuleSettings which contains more RuleSettings? How is the user code supposed to decide where to store? Also those RuleSettings are not accessible from the outside but it goes through a list of "Rules"? Is it me or this class only uses count()? This is incredibly meddled (of course I understand the area is muddy already ;-)).</p>

<p style="padding: 0; margin: 8px;">Disclaimer: All the renaming I propose is based on the assumption this inheritance doesn't change, if we decide later on to change it all my comments renaming RuleSettings to RuleSettingsBase might not apply anymore.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156567">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ruleslist.cpp:32</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa2211">:</span> <span class="n">QWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="p">,</span> <span class="n">m_settings</span><span class="p">(</span><span style="color: #aa4000">new</span> <span class="n">RuleSettingsManager</span><span class="p">(</span><span style="color: #aa4000">this</span><span class="p">))</span>
</div><div style="padding: 0 8px; margin: 0 4px; "><span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I don't think this is doing what you expect, you didn't declare m_settings as a pointer. I wonder if that couldn't even lead to a double delete... might not be the case a bit by chance (since children are cleaned-up in QObject dtor the KCMRulesList part of the object (including the m_settings member are long gone). Cheer luck ;-)</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156568">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ruleslist.cpp:61</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; "><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">for</span> <span class="p">(</span><span class="n">QVector</span><span style="color: #aa2211"><<span class="bright"></span></span><span class="bright"> </span><span class="n">Rules<span class="bright"></span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">*</span></span><span class="bright"> </span><span style="color: #aa2211">>::</span><span class="n">Iterator</span> <span class="n">it</span> <span style="color: #aa2211">=</span> <span class="n">rules</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">            <span class="n">it</span> <span style="color: #aa2211">!=</span> <span class="n">rules</span><span class="p">.</span><span class="n">end</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">            <span style="color: #aa2211">++</span><span class="n">it</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">for</span> <span class="p">(</span><span class="n">QVector</span><span style="color: #aa2211"><</span><span class="n">Rules<span class="bright"></span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">*</span>>::</span><span class="n">Iterator</span> <span class="n">it</span> <span style="color: #aa2211">=</span> <span class="bright"></span><span class="n"><span class="bright">m_</span>rules</span><span class="p">.</span><span class="n">begin</span><span class="p">();<span class="bright"></span></span><span class="bright"> </span><span class="n"><span class="bright">it</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">!=</span></span><span class="bright"> </span><span class="n"><span class="bright">m_rules</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">end</span></span><span class="bright"></span><span class="p"><span class="bright">();</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">++</span></span><span class="bright"></span><span class="n"><span class="bright">it</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; ">        <span style="color: #aa4000">delete</span> <span style="color: #aa2211">*</span><span class="n">it</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">or better yet use <tt style="background: #ebebeb; font-size: 13px;">qDeleteAll(m_rules)</tt></p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156570">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.cpp:101</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright"></span><span class="n"><span class="bright">K</span>Config<span class="bright"></span></span><span class="bright"> </span><span style="color: #004012"><span class="bright">cf</span>g</span><span class="p">(</span><span class="n">file</span><span class="p">.</span><span class="n">fileName</span><span class="p">(),</span> <span class="n">KConfig</span><span style="color: #aa2211">::</span><span class="n">SimpleConfig</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright"></span><span class="n"><span class="bright">readFromCfg</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">cfg</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="n">group<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">QS</span>tring<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">()));</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span style="color: #aa4000"><span class="bright">auto</span></span><span class="bright"> </span><span class="n"><span class="bright">cfg</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span class="n"><span class="bright">KShared</span>Config<span class="bright"></span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="bright"></span><span class="n"><span class="bright">openConfi</span>g</span><span class="p">(</span><span class="n">file</span><span class="p">.</span><span class="n">fileName</span><span class="p">(),</span> <span class="n">KConfig</span><span style="color: #aa2211">::</span><span class="n">SimpleConfig</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span style="color: #74777d"><span class="bright">// not completely sure this works, because </span>group<span class="bright"> name will be an empty non null s</span>tring</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">readFromSettings</span><span class="p">(</span><span class="n">RuleSettings</span><span class="p">(</span><span class="n">cfg</span><span class="p">,</span> <span class="n">QString</span><span class="p">()));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">So I guess it'll change ;-)</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156571">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.cpp:314</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span class="n">Rules</span><span style="color: #aa2211">::<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">Set</span>Rule</span> <span class="n">Rules</span><span style="color: #aa2211">::</span><span class="n">read<span class="bright">Set</span>Rule</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="bright"></span><span class="n"><span class="bright">KConfigGroup</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"> </span><span class="n"><span class="bright">cfg</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">const</span></span><span class="bright"> </span><span class="n"><span class="bright">QString</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"> </span><span class="n"><span class="bright">key</span></span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">int</span> <span class="n">v</span> <span style="color: #aa2211">=</span> <span class="n">cfg</span><span class="p">.</span><span class="n">readEntry</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span style="color: #601200">0</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">v</span> <span style="color: #aa2211">>=</span> <span class="n">DontAffect</span> <span style="color: #aa2211">&&</span> <span class="n">v</span> <span style="color: #aa2211"><=</span> <span class="n">ForceTemporarily</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span style="color: #aa4000">return</span> <span style="color: #aa4000">static_cast</span><span style="color: #aa2211"><</span> <span class="n">SetRule</span> <span style="color: #aa2211">></span><span class="p">(</span><span class="n">v</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">return</span> <span class="n">UnusedSetRule</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span class="p">}</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span class="n">Rules</span><span style="color: #aa2211">::</span><span class="n">ForceRule</span> <span class="n">Rules</span><span style="color: #aa2211">::</span><span class="n">readForceRule</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">KConfigGroup</span><span style="color: #aa2211">&</span> <span class="n">cfg</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span> <span class="n">key</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="n">Rules</span><span style="color: #aa2211">::<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">Force</span>Rule</span> <span class="n">Rules</span><span style="color: #aa2211">::</span><span class="n">read<span class="bright">Force</span>Rule</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="bright"></span><span style="color: #aa4000"><span class="bright">int</span></span><span class="bright"> </span><span class="n"><span class="bright">v</span></span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; "><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">int</span> <span class="n">v</span> <span style="color: #aa2211">=</span> <span class="n">cfg</span><span class="p">.</span><span class="n">readEntry</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span style="color: #601200">0</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">int v</tt>, the const is mostly useless here</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156572">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.cpp:1025</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">for</span> <span class="p">(</span><span style="color: #aa4000">int</span> <span class="n">i</span> <span style="color: #aa2211">=</span> <span style="color: #601200">1</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright">    </span><span class="n"><span class="bright">i</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright"><=</span></span><span class="bright"> </span><span class="n"><span class="bright">count</span></span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright">    </span><span style="color: #aa2211"><span class="bright">++</span></span><span class="bright"></span><span class="n"><span class="bright">i</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="n">KConfigGroup</span> <span class="n">cg</span><span class="p">(</span><span class="n">m_config</span><span class="p">,</span> <span class="n">QString</span><span style="color: #aa2211">::</span><span class="n">number</span><span class="p">(</span><span class="n">i</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="n">Rules</span><span style="color: #aa2211">*</span> <span class="n">rule</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">Rules</span><span class="p">(</span><span class="n">cg</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">for</span> <span class="p">(</span><span style="color: #aa4000">int</span> <span class="n">i</span> <span style="color: #aa2211">=</span> <span style="color: #601200">1</span><span class="p">;<span class="bright"></span></span><span class="bright"> </span><span class="n"><span class="bright">i</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright"><=</span></span><span class="bright"> </span><span class="n"><span class="bright">settings</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">count</span></span><span class="bright"></span><span class="p"><span class="bright">();</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">++</span></span><span class="bright"></span><span class="n"><span class="bright">i</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span class="n"><span class="bright">RuleSettings</span></span><span class="bright"> </span><span class="n"><span class="bright">settings</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">m_config</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span class="n"><span class="bright">QString</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="bright"></span><span class="n"><span class="bright">number</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">i</span></span><span class="bright"></span><span class="p"><span class="bright">))</span>;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span class="n"><span class="bright">Rules</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">*</span></span><span class="bright"> </span><span class="n"><span class="bright">rule</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">new</span></span><span class="bright"> </span><span class="n"><span class="bright">Rules</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">settings</span></span><span class="bright"></span><span class="p"><span class="bright">);</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Yeah this lack of separation between General and parameterized groups really feels wrong</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156573">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.cpp:1026</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright">    </span><span class="n"><span class="bright">i</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright"><=</span></span><span class="bright"> </span><span class="n"><span class="bright">count</span></span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright">    </span><span style="color: #aa2211"><span class="bright">++</span></span><span class="bright"></span><span class="n"><span class="bright">i</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="n">KConfigGroup</span> <span class="n">cg</span><span class="p">(</span><span class="n">m_config</span><span class="p">,</span> <span class="n">QString</span><span style="color: #aa2211">::</span><span class="n">number</span><span class="p">(</span><span class="n">i</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="n">Rules</span><span style="color: #aa2211">*</span> <span class="n">rule</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">Rules</span><span class="p">(</span><span class="n">cg</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span class="n"><span class="bright">RuleSettings</span></span><span class="bright"> </span><span class="n"><span class="bright">settings</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">m_config</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span class="n"><span class="bright">QString</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="bright"></span><span class="n"><span class="bright">number</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">i</span></span><span class="bright"></span><span class="p"><span class="bright">))</span>;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span class="n"><span class="bright">Rules</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">*</span></span><span class="bright"> </span><span class="n"><span class="bright">rule</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">new</span></span><span class="bright"> </span><span class="n"><span class="bright">Rules</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">settings</span></span><span class="bright"></span><span class="p"><span class="bright">);</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; ">        <span class="n">m_rules</span><span class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">rule</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Space before * not after</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156574">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.cpp:1039</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span class="n">QStringList</span> <span class="n">groups</span> <span style="color: #aa2211">=</span> <span class="n">m_config</span><span style="color: #aa2211">-></span><span class="n">groupList</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">for</span> <span class="p">(<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">QStringList</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="bright"></span><span class="n"><span class="bright">C</span>onst<span class="bright">Iterator</span></span><span class="bright"> </span><span class="n"><span class="bright">it</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span> <span class="n">groups<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">constBegin</span></span><span class="bright"></span><span class="p"><span class="bright">();</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright">    </span><span class="n"><span class="bright">it</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">!=</span></span><span class="bright"> </span><span class="n">group<span class="bright">s</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">constEnd</span></span><span class="bright"></span><span class="p"><span class="bright">(</span>);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">            <span style="color: #aa2211">++</span><span class="n">it</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="n">m_config</span><span style="color: #aa2211">-></span><span class="n">deleteGroup</span><span class="p">(</span><span style="color: #aa2211">*</span><span class="n">it</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">m_config</span><span style="color: #aa2211">-></span><span class="n">group</span><span class="p">(</span><span style="color: #766510">"General"</span><span class="p">).</span><span class="n">writeEntry</span><span class="p">(</span><span style="color: #766510">"count"</span><span class="p">,</span> <span class="n">m_rules</span><span class="p">.</span><span class="n">count</span><span class="p">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">for</span> <span class="p">(<span class="bright"></span></span><span class="bright"></span><span style="color: #aa4000"><span class="bright">c</span>onst<span class="bright"></span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">auto</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"></span><span style="color: #a0a000"><span class="bright">group</span></span><span class="bright"> </span><span class="p"><span class="bright">:</span></span> <span class="n">groups<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span class="n"><span class="bright">m_config</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">deleteGroup</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="n">group</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">declare groups as const or wrap it in qAsConst here</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D27682#inline-156575">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.cpp:1044</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright">        </span><span class="n"><span class="bright">it</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">!=</span></span><span class="bright"> </span><span class="n">m_rules</span><span class="p">.</span><span class="n">co<span class="bright">nstEnd</span></span><span class="bright"></span><span class="p"><span class="bright">(</span>);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright">        </span><span style="color: #aa2211"><span class="bright">++</span></span><span class="bright"></span><span class="n"><span class="bright">it</span></span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">        <span class="bright"></span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">((</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">*</span></span><span class="bright"></span><span class="n"><span class="bright">it</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">isTemporary</span></span><span class="bright"></span><span class="p"><span class="bright">())</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span class="n"><span class="bright">settings</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">setCount</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="n">m_rules</span><span class="p">.</span><span class="n">co<span class="bright">unt</span></span><span class="bright"></span><span class="p"><span class="bright">()</span>);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span style="color: #aa4000"><span class="bright">for</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span style="color: #aa4000"><span class="bright">const</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">auto</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"></span><span style="color: #a0a000"><span class="bright">rule</span></span><span class="bright"></span><span class="p"><span class="bright">:</span></span><span class="bright"> </span><span class="n"><span class="bright">m_rules</span></span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="bright"></span><span class="n"><span class="bright">RuleSettings</span></span><span class="bright"> </span><span class="n"><span class="bright">settings</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">m_config</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span class="n"><span class="bright">QString</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="bright"></span><span class="n"><span class="bright">number</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">i</span></span><span class="bright"></span><span class="p"><span class="bright">));</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">qAsConst(m_rules)</tt></p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27682">https://phabricator.kde.org/D27682</a></div></div><br /><div><strong>To: </strong>hchain, meven, crossi, bport, ervin, KWin<br /><strong>Cc: </strong>zzag, kwin, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, apol, ahiemstra, mart<br /></div>