<table><tr><td style="">rkflx created this revision.<br />rkflx added a reviewer: Frameworks.<br />Restricted Application added a project: Frameworks.<br />rkflx requested review of this revision.
</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/D12592">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p><a href="https://phabricator.kde.org/R446:cc00bbb22010af94a2eb95d12201fbeceec17681" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">cc00bbb22010</a> tried to prevent the places panel from reopening with a<br />
width reduced by 1px compared to the previous invocation of the file<br />
dialog.</p>

<p>While the patch worked on the surface when it was applied, the actual<br />
reasoning was wrong: The difference was not because of "extra resize()<br />
events", but because of a mismatch between what was read from the config<br />
(<tt style="background: #ebebeb; font-size: 13px;">placesViewWidth</tt>) and what was written to the config (<tt style="background: #ebebeb; font-size: 13px;">sizes[0]</tt>).</p>

<p>The actual reason <tt style="background: #ebebeb; font-size: 13px;">placesViewWidth</tt> and <tt style="background: #ebebeb; font-size: 13px;">sizes[0]</tt> are different is<br />
because of a previous error: It is assumed that the splitter sizes sum<br />
up to <tt style="background: #ebebeb; font-size: 13px;">availableWidth</tt>, while in reality this width also contains the<br />
width of the splitter handle. Upon <tt style="background: #ebebeb; font-size: 13px;">setSizes</tt>, Qt equally takes away<br />
width from both sides of the splitter to make everything fit.</p>

<p>While for the Oxygen and Fusion styles (3px and 4px splitter handle<br />
width, respectively) an adjustment of 1px did the trick, for Breeze with<br />
its splitter handle width of only 1px this did not work anymore due to<br />
rounding errors, it resulted in the config entry incrementing by 1px for<br />
every invocation of the dialog.</p>

<p>To fix the problem for every style, we simply take the width of the<br />
splitter handle into account and revert the previous fix. While we are<br />
at it, we refactor to make everything more DRY.</p>

<p>Ref <a href="https://phabricator.kde.org/T8552" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">T8552</a></p>

<p>FIXED-IN: 5.46</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Setup monitoring with <tt style="background: #ebebeb; font-size: 13px;">watch grep Speedbar ~/.config/kdeglobals</tt>.<br />
Repeatedly open <tt style="background: #ebebeb; font-size: 13px;">kdialog --getopenfilename</tt>, click on <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">Cancel</span></span></span> and<br />
check that the config entry does not change. Test for multiple widget<br />
styles (e.g. Breeze, Oxygen, Windows and Fusion), as well as for hiding<br />
the places panel and manually moving the splitter to both ends.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>BRANCH</strong><div><div>fix-places-width-growth (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D12592">https://phabricator.kde.org/D12592</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/filewidgets/kfilewidget.cpp</div></div></div><br /><div><strong>To: </strong>rkflx, Frameworks<br /><strong>Cc: </strong>michaelh, bruns<br /></div>