<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/D8367" rel="noreferrer">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/D8367#inline-37294" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesmodeltest.cpp:504</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">QList</span><span style="color: #aa2211"><</span><span class="n">QVariant</span><span style="color: #aa2211">></span> <span class="n">args</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="n">QSignalSpy</span> <span style="color: #004012">spy_inserted</span><span class="p">(</span><span class="n">m_places</span><span class="p">,</span> <span class="bright"></span><span class="n"><span class="bright">SIGNAL</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="n">rowsInserted<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">QModelIndex</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="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="p"><span class="bright">))</span>);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"> <span class="n">QSignalSpy</span> <span style="color: #004012">spy_removed</span><span class="p">(</span><span class="n">m_places</span><span class="p">,</span> <span class="bright"></span><span class="n"><span class="bright">SIGNAL</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="n">rowsRemoved<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">QModelIndex</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="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="p"><span class="bright">))</span>);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QSignalSpy</span> <span style="color: #004012">spy_inserted</span><span class="p">(</span><span class="n">m_places</span><span class="p">,</span> <span class="bright"></span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"></span><span class="n"><span class="bright">KFilePlacesModel</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="n">rowsInserted</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">QSignalSpy</span> <span style="color: #004012">spy_removed</span><span class="p">(</span><span class="n">m_places</span><span class="p">,</span> <span class="bright"></span><span style="color: #aa2211"><span class="bright">&</span></span><span class="bright"></span><span class="n"><span class="bright">KFilePlacesModel</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="n">rowsRemoved</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">All those unrelated connect style changes would have been better in a separate commit.</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/D8367#inline-37295" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesitem.cpp: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; background: rgba(251, 175, 175, .7);"> <span style="color: #aa4000">const</span> <span class="n">GroupType</span> <span class="n">type</span> <span style="color: #aa2211">=</span> <span class="n">groupType</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">const</span> <span class="bright"></span><span class="n"><span class="bright">KFilePlacesModel</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">::</span></span><span class="n">GroupType</span> <span class="n">type</span> <span style="color: #aa2211">=</span> <span class="n">groupType</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa4000">switch</span> <span class="p">(</span><span class="n">type</span><span class="p">)</span> <span class="p">{</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Same thing the enum move could have been a separate commit.</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/D8367#inline-37297" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesitem.cpp:122-123</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">case</span> <span class="n">KFilePlacesModel</span><span style="color: #aa2211">::</span><span style="color: #a0a000">UnknownType</span><span class="p">:</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">Q_ASSERT</span><span class="p">(</span><span style="color: #304a96">false</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">break</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa4000">default</span><span style="color: #aa2211">:</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">A fallthrough would be better 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/D8367#inline-37298" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesitem.cpp:202</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">case</span> <span class="n">Qt</span><span style="color: #aa2211">::</span><span style="color: #a0a000">BackgroundRole</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 class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">b</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">metaDataItem</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">QStringLiteral</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">"I</span>sHidden<span class="bright">"</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">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">"true"</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 style="color: #aa4000">if</span> <span class="p">(<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">i</span>sHidden<span class="bright"></span></span><span class="bright"></span><span class="p"><span class="bright">(</span>))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; "> <span style="color: #aa4000">return</span> <span class="n">QColor</span><span class="p">(</span><span class="n">Qt</span><span style="color: #aa2211">::</span><span class="n">lightGray</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Very welcome refactoring... in a separate commit</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/D8367#inline-37303" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesmodel.cpp:62-74</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">static</span> <span style="color: #aa4000">const</span> <span class="n">QHash</span><span style="color: #aa2211"><</span><span class="n">QString</span><span class="p">,</span> <span class="n">KFilePlacesModel</span><span style="color: #aa2211">::</span><span class="n">GroupType</span><span style="color: #aa2211">></span> <span class="n">groupStateNameToType</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 style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">static</span> <span style="color: #aa4000">const</span> <span class="n">QHash</span><span style="color: #aa2211"><</span><span class="n">QString</span><span class="p">,</span> <span class="n">KFilePlacesModel</span><span style="color: #aa2211">::</span><span class="n">GroupType</span><span style="color: #aa2211">></span> <span class="n">gpStateNameToType</span> <span style="color: #aa2211">=</span>
</div><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 class="p">{</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"GroupState-Places-IsHidden"</span><span class="p">),</span> <span class="n">KFilePlacesModel</span><span style="color: #aa2211">::</span><span class="n">PlacesType</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">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"GroupState-RecentlySaved-IsHidden"</span><span class="p">),</span> <span class="n">KFilePlacesModel</span><span style="color: #aa2211">::</span><span class="n">RecentlySavedType</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">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"GroupState-SearchFor-IsHidden"</span><span class="p">),</span> <span class="n">KFilePlacesModel</span><span style="color: #aa2211">::</span><span class="n">SearchForType</span> <span class="p">},</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Just make it a const global static then... No need to recreate this hash several times.</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/D8367#inline-37304" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesmodel.cpp:160</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">root</span><span class="p">.</span><span class="n">setMetaDataItem</span><span class="p">(</span><span class="n">groupStateNameToType</span><span class="p">().</span><span class="n">key</span><span class="p">(</span><span class="n">PlacesType</span><span class="p">),</span> <span class="p">(</span><span class="n">areGroupsHiddenByDefault</span> <span style="color: #aa2211">?</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"true"</span><span class="p">)</span> <span style="color: #aa2211">:</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"false"</span><span class="p">)));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span class="n">root</span><span class="p">.</span><span class="n">setMetaDataItem</span><span class="p">(</span><span class="n">groupStateNameToType</span><span class="p">().</span><span class="n">key</span><span class="p">(</span><span class="n">DevicesType</span><span class="p">),</span> <span class="p">(</span><span class="n">areGroupsHiddenByDefault</span> <span style="color: #aa2211">?</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"true"</span><span class="p">)</span> <span style="color: #aa2211">:</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"false"</span><span class="p">)));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">You always use the hash with .key() which is very inefficient, so why not swap key and value types and rename it groupTypeToStateName?</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/D8367#inline-37306" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesmodel.cpp:875</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">bookmark</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">setMetaDataItem</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">QStringLiteral</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">"IsHidden"</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><span class="bright"></span><span class="n"><span class="bright">hidden</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">QStringLiteral</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">"true"</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">QStringLiteral</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">"false"</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">const</span></span><span class="bright"> </span><span class="n"><span class="bright">QHash</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">GroupType</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">bool</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">gpStateHidden</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">groupStateHidden</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">d</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">bookmarkManager</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">root</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 style="color: #aa4000">const</span> <span style="color: #aa4000">bool</span> <span class="n">hiddingChildOnShownParent</span> <span style="color: #aa2211">=</span> <span class="n">hidden</span> <span style="color: #aa2211">&&</span> <span style="color: #aa2211">!</span><span class="n">gpStateHidden</span><span class="p">.</span><span class="n">value</span><span class="p">(</span><span class="n">item</span><span style="color: #aa2211">-></span><span class="n">groupType</span><span class="p">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"> <span style="color: #aa4000">const</span> <span style="color: #aa4000">bool</span> <span class="n">showingChildOnShownParent</span> <span style="color: #aa2211">=</span> <span style="color: #aa2211">!</span><span class="n">hidden</span> <span style="color: #aa2211">&&</span> <span style="color: #aa2211">!</span><span class="n">gpStateHidden</span><span class="p">.</span><span class="n">value</span><span class="p">(</span><span class="n">item</span><span style="color: #aa2211">-></span><span class="n">groupType</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Typo: hiding</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/D8367#inline-37300" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">kfileplacesmodel.h:55</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">enum</span> <span class="n">GroupType</span>
</div><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 class="n">PlacesType</span><span class="p">,</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Better have the curly brace on the same line than the enum name to be consistent with the other enum just on top.</p>
<p style="padding: 0; margin: 8px;">Also the enum itself needs to carry over the changes which have been applied to previous commits.</p></div></div></div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D8367" rel="noreferrer">https://phabricator.kde.org/D8367</a></div></div><br /><div><strong>To: </strong>mlaurent, renatoo, ngraham, franckarrecot, ervin<br /><strong>Cc: </strong>ngraham, mlaurent, Frameworks<br /></div>