<table><tr><td style="">dfaure added a comment.
</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/D28221">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D28221#643799" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">D28221#643799</a>, <a href="https://phabricator.kde.org/p/bport/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@bport</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D28221#641971" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">D28221#641971</a>, <a href="https://phabricator.kde.org/p/dfaure/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@dfaure</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><p>I have a hard time accepting that the documentation was wrong -- and if it was, then this commit has to fix it, and port as much of the app code that does exactly this, as possible.</p></div>
</blockquote>
<p>From my POV documentation is not "wrong"</p></div>
</blockquote>
<p>I'm talking about this documentation (kconfiggroup.h)</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);">* \code
* if ( (value == computedDefault) && !group.hasDefault(key) )
* group.revertToDefault(key);
* else
* group.writeEntry(key, value);
* \endcode</pre></div>
<p>You cannot say "this is not wrong" and then port every piece of code that you see(like kwindowconfig.cpp) away from the hasDefault check :-)<br />
Either it's right, or it's wrong, as a general practice for when to call revertToDefault.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>but this point of view describe only default from cpp, no default from global file.</p></blockquote>
<p>Well, we need code that works with both, obviously.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>The current implementation and I don't know why (perhaps I will need to do some archeology there) don't allow to follow default value if it came from a file and follow changes made in the file over time. Like we do with cpp default.</p></blockquote>
<p>I thought the logic was always "if the value matches one coming from a more-global config file, then don't write it".<br />
KConfig can see all layers of files, so it can do that by itself.<br />
What KConfig cannot see (in a writeEntry call) is the cpp-computed-default and that's why this case needs special handling in the app code itself.</p>
<p>AFAICS the heart of the matter is what should happen when both exist.<br />
A C++ default, and a global-file default. If we're saving a value equal to the C++ default, then we have to write it out, otherwise upon reading the global-file default will interfer. That's what the hasDefault() check before revertToDefault() is about, AFAICS. Assuming revertToDefault means "do not write anything in my local config file".</p>
<p>What complicates my ability to review this, is the "mix" between the two layers. Plain KConfig/KConfigGroup, and KConfigSkeletionItem stuff.<br />
Any chance you could add plain-KConfig unittests? This would help making sure that the changes in e.g. kconfigdata.cpp aren't compensated by changes in KConfigSkeletonItem, and that plain KConfig usage works as it should.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R237 KConfig</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28221">https://phabricator.kde.org/D28221</a></div></div><br /><div><strong>To: </strong>bport, ervin, dfaure, davidedmundson<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns<br /></div>