<table><tr><td style="">nononux marked 11 inline comments as done.<br />nononux 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/D22199">View Revision</a></tr></table><br /><div><div><p>Thanks for your advices for my first KDE dev. I hope I've taken them into account in a good way.</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/D22199#inline-125160">View Inline</a><span style="color: #4b4d51; font-weight: bold;">pino</span> wrote in <span style="color: #4b4d51; font-weight: bold;">kateopenselectionplugin.desktop:6-7</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">Please do not add translations manually, there is a KDE-wide system to handle them.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I removed all the translations. Is it a dedicated team who do the translations ?</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/D22199#inline-125153">View Inline</a><span style="color: #4b4d51; font-weight: bold;">pino</span> wrote in <span style="color: #4b4d51; font-weight: bold;">plugin_kateopenselection.cpp:59</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">In addition to what Yuri said:a better action text, more in line with our HIG [1] is IMHO "Open Selected Path".<br />
"Opens the selected path" can be a good tooltip or whatsthis text.</p>
<p style="padding: 0; margin: 8px;">[1] <a href="https://hig.kde.org/style/writing/index.html" class="remarkup-link" target="_blank" rel="noreferrer">https://hig.kde.org/style/writing/index.html</a></p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I've put "Open selected path" as it seems the others texts in my menu doesn't have all first letters capitalized.</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/D22199#inline-125155">View Inline</a><span style="color: #4b4d51; font-weight: bold;">pino</span> wrote in <span style="color: #4b4d51; font-weight: bold;">plugin_kateopenselection.cpp:114</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">This condition (and the same below for <tt style="background: #ebebeb; font-size: 13px;">end</tt>) is hard to read, as it mixes checks and an assignment mid-way.<br />
A suggestion to make it simpler, and also avoid the duplicated checks is to put the character checks in a small helper:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="c++" 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);"><span style="color: #aa4000">static</span> <span style="color: #aa4000">bool</span> <span style="color: #004012">isValidChar</span><span class="p">(</span><span class="n">QChar</span> <span class="n">c</span><span class="p">)</span>
<span class="p">{</span>
<span style="color: #aa4000">return</span> <span class="n">c</span> <span style="color: #aa2211">!=</span> <span class="n">QLatin1Char</span><span class="p">(</span><span style="color: #766510">' '</span><span class="p">)</span> <span style="color: #aa2211">&&</span> <span class="n">c</span> <span style="color: #aa2211">!=</span> <span class="n">QLatin1Char</span><span class="p">(</span><span style="color: #766510">'\t'</span><span class="p">)</span> <span style="color: #aa2211">&&</span> <span class="n">c</span> <span style="color: #aa2211">!=</span> <span class="n">QLatin1Char</span><span class="p">(</span><span style="color: #766510">'"'</span><span class="p">)</span> <span style="color: #aa2211">&&</span> <span class="n">c</span> <span style="color: #aa2211">!=</span> <span class="n">QLatin1Char</span><span class="p">(</span><span style="color: #766510">'\''</span><span class="p">);</span>
<span class="p">}</span></pre></div>
<p style="padding: 0; margin: 8px;">and thus using it:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="c++" 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);"><span style="color: #aa4000">while</span> <span class="p">(</span><span class="n">start</span> <span style="color: #aa2211">></span> <span style="color: #601200">0</span> <span style="color: #aa2211">&&</span> <span class="n">isValidChar</span><span class="p">(</span><span class="n">line</span><span class="p">.</span><span class="n">at</span><span class="p">(</span><span class="n">start</span> <span style="color: #aa2211">-</span> <span style="color: #601200">1</span><span class="p">))</span></pre></div>
<p style="padding: 0; margin: 8px;">Way more readable IMHO.</p>
<p style="padding: 0; margin: 8px;">Also, most probably other characters can be excluded from what is a file path -- for example word boundaries, newlines, etc. Check the QChar API documentation to see whether there are character classes that can help here.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Done, I use isSpace() to capture more characters (\n, \r, ...). Maybe it is better to put the function in the class as a private function ?</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/D22199#inline-125156">View Inline</a><span style="color: #4b4d51; font-weight: bold;">pino</span> wrote in <span style="color: #4b4d51; font-weight: bold;">plugin_kateopenselection.cpp:134</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">Excluding the newline in the code above (see my <tt style="background: #ebebeb; font-size: 13px;">isValidChar()</tt> suggestion) can avoid the need to check for newline here.</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I think the test should be kept : if a multi-line text is selected, it can contain a newline (not removed by the trimmed function).</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/D22199#inline-125158">View Inline</a><span style="color: #4b4d51; font-weight: bold;">pino</span> wrote in <span style="color: #4b4d51; font-weight: bold;">plugin_kateopenselection.cpp:135</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">This assumes the string is a local file -- what if under the cursor there is a remote URL?</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">The name of the function 'fromLocalFile' is a bit ambiguous. The QUrl doc (<a href="https://doc.qt.io/qt-5/qurl.html#fromLocalFile" class="remarkup-link" target="_blank" rel="noreferrer">https://doc.qt.io/qt-5/qurl.html#fromLocalFile</a>) says this function work with remote files, with a path starting with //.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R40 Kate</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22199">https://phabricator.kde.org/D22199</a></div></div><br /><div><strong>To: </strong>nononux<br /><strong>Cc: </strong>dhaumann, pino, yurchor, kwrite-devel, kde-doc-english, gennad, fbampaloukas, domson, michaelh, ngraham, demsking, skadinna, cullmann, sars<br /></div>