<table><tr><td style="">ervin requested changes to this revision.<br />ervin added inline comments.<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><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-157509">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulebooksettings.h: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: #aa4000">void</span> <span style="color: #004012">saveAllFrom</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QVector</span><span style="color: #aa2211"><</span><span class="n">Rules</span> <span style="color: #aa2211">*></span> <span style="color: #aa2211">&</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">void</span> <span style="color: #004012">loadAllInto</span><span class="p">(</span><span class="n">QVector</span><span style="color: #aa2211"><</span><span class="n">Rules</span> <span style="color: #aa2211">*></span> <span style="color: #aa2211">&</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This is a rather unusual pattern and it prevents declaring the list const in the caller, I'd return a new QVector instead (especially since the the implementation clears the vector anyway).</p>

<p style="padding: 0; margin: 8px;">Thus you could rename both as saveAll and loadAll.</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-157515">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulebooksettings.h: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: #aa4000">void</span> <span style="color: #004012">saveAllFrom</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QVector</span><span style="color: #aa2211"><</span><span class="n">Rules</span> <span style="color: #aa2211">*></span> <span style="color: #aa2211">&</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">void</span> <span style="color: #004012">loadAllInto</span><span class="p">(</span><span class="n">QVector</span><span style="color: #aa2211"><</span><span class="n">Rules</span> <span style="color: #aa2211">*></span> <span style="color: #aa2211">&</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Actually I also wonder if it would make sense to instead separate load/save from getting/setting the rules. It'd be more similar to what we usually if we have a rules()/setRules() pair (which would probably impact the count property automatically).</p>

<p style="padding: 0; margin: 8px;">Then usrRead() and usrSave() could be overridden to deal with loading/saving the actual content of the list when load/save is called on the rule book.</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-157510">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rulebooksettingsbase.kcfg:14</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);"></kcfg>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Phab seems to not like that. :-)</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-157519">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ruleslist.cpp:211</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">rules_listbox</span><span style="color: #aa2211">-></span><span class="n">clear</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">for</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">QVector</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">Rules</span></span><span class="bright"></span><span style="color: #aa2211"><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">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="bright"> </span><span class="n">rules<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">begin</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">rules<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">end</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 style="color: #aa4000">delete</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">rules</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">KConfig</span> <span style="color: #004012">_cfg</span><span class="p">(</span><span style="color: #766510">"kwinrulesrc"</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">KConfigGroup</span> <span style="color: #004012">cfg</span><span class="p">(</span><span style="color: #aa2211">&</span><span class="n">_cfg</span><span class="p">,</span> <span style="color: #766510">"General"</span><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">count</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 style="color: #766510">"count"</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 class="n">rules</span><span class="p">.</span><span class="n">reserve</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(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="n">i</span> <span style="color: #aa2211"><=</span> <span class="n">count</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">i</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="n">cfg</span> <span style="color: #aa2211">=</span> <span class="n">KConfigGroup</span><span class="p">(</span><span style="color: #aa2211">&</span><span class="n">_cfg</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">cfg</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 class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">rule</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">m_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">loadAllInto</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_</span>rules</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: #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: #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_</span>rules<span class="bright"></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></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">With my proposal it'd become:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">m_settings->load();
m_rules = m_settings->rules();</pre></div></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-157517">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ruleslist.cpp:212</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 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 class="n"><span class="bright">QVector</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">Rules</span></span><span class="bright"></span><span style="color: #aa2211"><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">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="bright"> </span><span class="n">rules<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">begin</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">rules<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">end</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 style="color: #aa4000">delete</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">rules</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">KConfig</span> <span style="color: #004012">_cfg</span><span class="p">(</span><span style="color: #766510">"kwinrulesrc"</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">KConfigGroup</span> <span style="color: #004012">cfg</span><span class="p">(</span><span style="color: #aa2211">&</span><span class="n">_cfg</span><span class="p">,</span> <span style="color: #766510">"General"</span><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">count</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 style="color: #766510">"count"</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 class="n">rules</span><span class="p">.</span><span class="n">reserve</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(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="n">i</span> <span style="color: #aa2211"><=</span> <span class="n">count</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">i</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="n">cfg</span> <span style="color: #aa2211">=</span> <span class="n">KConfigGroup</span><span class="p">(</span><span style="color: #aa2211">&</span><span class="n">_cfg</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">cfg</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 class="p">.</span><span class="n">append</span><span class="p">(</span><span class="n">rule</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">m_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">loadAllInto</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_</span>rules</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: #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: #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_</span>rules<span class="bright"></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; ">        <span class="n">rules_listbox</span><span style="color: #aa2211">-></span><span class="n">addItem</span><span class="p">(</span><span class="n">rule</span><span style="color: #aa2211">-></span><span class="n">description</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Would need a qAsConst around m_rules</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-157518">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ruleslist.cpp:225</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 class="bright"></span><span class="n"><span class="bright">KConfig</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 class="n"><span class="bright">QLatin1String</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span style="color: #766510"><span class="bright">"kwin</span>rules<span class="bright">rc"</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">QStringList</span> <span class="n">groups</span> <span style="color: #aa2211">=</span> <span class="n">cfg</span><span class="p">.</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><span class="n">QStringList</span><span style="color: #aa2211">::</span><span class="n">ConstIterator</span> <span class="n">it</span> <span style="color: #aa2211">=</span> <span class="n">groups</span><span class="p">.</span><span class="n">constBegin</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">groups</span><span class="p">.</span><span class="n">constEnd</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(251, 175, 175, .7);">        <span class="n">cfg</span><span class="p">.</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">cfg</span><span class="p">.</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">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(251, 175, 175, .7);">    <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 style="color: #aa4000">for</span> <span class="p">(</span><span class="n">QVector</span><span style="color: #aa2211"><</span> <span class="n">Rules</span><span style="color: #aa2211">*</span> <span style="color: #aa2211">>::</span><span class="n">ConstIterator</span> <span class="n">it</span> <span style="color: #aa2211">=</span> <span class="n">rules</span><span class="p">.</span><span class="n">constBegin</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">constEnd</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> <span class="p">{</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 style="color: #aa2211">&</span><span class="n">cfg</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="p">(</span><span style="color: #aa2211">*</span><span class="n">it</span><span class="p">)</span><span style="color: #aa2211">-></span><span class="n">write</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(251, 175, 175, .7);">        <span style="color: #aa2211">++</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="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">m_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">saveAllFrom</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_</span>rules</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;">With my proposal it'd become:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">m_settings->setRules(m_rules);
m_settings->save();</pre></div></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-157523">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 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">bookSettings</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;">I wonder if that would still make sense if we got a getter for the list.</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-157520">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.h:104</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">Rules</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">explicit</span> <span style="color: #004012">Rules</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 style="color: #aa2211">&</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">explicit</span> <span style="color: #004012">Rules</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="bright"></span><span class="n"><span class="bright">RuleSettings</span></span><span style="color: #aa2211">&</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span class="n">Rules</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QString</span><span style="color: #aa2211">&</span><span class="p">,</span> <span style="color: #aa4000">bool</span> <span class="n">temporary</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I'd expect it via pointer since RuleSettings isn't a data type.</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-157521">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.h:141</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="p">};</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">void</span> <span style="color: #004012">write</span><span class="p">(</span><span class="n">RuleSettings</span><span style="color: #aa2211">&</span><span class="p">)</span> <span style="color: #aa4000">const</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">bool</span> <span style="color: #004012">isEmpty</span><span class="p">()</span> <span style="color: #aa4000">const</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Same thing, I'd expect a pointer not a reference.</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-157522">View Inline</a><span style="color: #4b4d51; font-weight: bold;">rules.h:194</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: #aa4000">bool</span> <span style="color: #004012">matchClientMachine</span><span class="p">(</span><span style="color: #aa4000">const</span> <span class="n">QByteArray</span><span style="color: #aa2211">&</span> <span class="n">match_machine</span><span class="p">,</span> <span style="color: #aa4000">bool</span> <span class="n">local</span><span class="p">)</span> <span style="color: #aa4000">const</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">enum</span></span><span class="bright"> </span><span class="n"><span class="bright">Set</span>Rule<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="bright">    </span><span class="n"><span class="bright">UnusedSet</span>Rule<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">Unused</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">void</span></span><span class="bright"> </span><span style="color: #004012"><span class="bright">readFromSettings</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">Rule<span class="bright">Settings</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>
</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">static</span></span><span class="bright"> </span><span class="n"><span class="bright">ForceRule</span></span><span class="bright"> </span><span style="color: #004012"><span class="bright">readForce</span>Rule<span class="bright"></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">int</span></span><span class="bright"> </span><span class="n"><span class="bright">v</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;">And here as well.</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>ognarb, 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>