<table><tr><td style="">dfaure requested changes to this revision.<br />dfaure added a comment.<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/D26557">View Revision</a></tr></table><br /><div><div><p>Please add me as reviewer when touching my code in KIO. I almost didn't notice this one.</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/D26557#inline-150033">View Inline</a><span style="color: #4b4d51; font-weight: bold;">desktopexecparser.cpp:213</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: #74777d">// add x-scheme-handler/<protocol></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">const</span> <span style="color: #aa4000">auto</span> <span style="color: #aa2211">&</span><span style="color: #a0a000">mimeType</span> <span class="p">:</span> <span class="n">service</span><span class="p">.</span><span class="n">serviceTypes</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><span class="n">mimeType</span><span class="p">.</span><span class="n">startsWith</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"x-scheme-handler/"</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;">Move result of method call into local const variable. The usual range-for-detaches problem.</p>

<p style="padding: 0; margin: 8px;">Can you call mimeTypes() instead of serviceTypes() here? I'm trying to slowly split the two notions, after it all got mixed up long ago.</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/D26557#inline-150034">View Inline</a><span style="color: #4b4d51; font-weight: bold;">desktopexecparser.cpp:214</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">for</span> <span class="p">(</span><span style="color: #aa4000">const</span> <span style="color: #aa4000">auto</span> <span style="color: #aa2211">&</span><span style="color: #a0a000">mimeType</span> <span class="p">:</span> <span class="n">service</span><span class="p">.</span><span class="n">serviceTypes</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><span class="n">mimeType</span><span class="p">.</span><span class="n">startsWith</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"x-scheme-handler/"</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 class="n">supportedProtocols</span> <span style="color: #aa2211"><<</span> <span class="n">mimeType</span><span class="p">.</span><span class="n">mid</span><span class="p">(</span><span style="color: #601200">17</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">QLatin1String is enough 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/D26557#inline-150049">View Inline</a><span style="color: #4b4d51; font-weight: bold;">krun.cpp:101</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="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #74777d">// We have up to two sources of data, for protocols not handled by kioslaves (so called "helper") :</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #74777d">// 1) the exec line of the .protocol file, if there's one</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">OK I wasn't happy about this docu disappearing but actually it fits better into hasSchemeHandler() which I later on moved to KIO::DesktopExecParser.</p>

<p style="padding: 0; margin: 8px;">Done in <a href="https://commits.kde.org/kio/45f5d79600809f4c153c7b39ad90652cb921875c" class="remarkup-link" target="_blank" rel="noreferrer">https://commits.kde.org/kio/45f5d79600809f4c153c7b39ad90652cb921875c</a><br />
You can now remove it from here indeed :)</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/D26557#inline-150038">View Inline</a><span style="color: #4b4d51; font-weight: bold;">krun.cpp:106</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">Q_ASSERT</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">KProtocolInfo</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">isHelperProtocol</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">protocol</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: #aa4000">return</span> <span class="n">KProtocolInfo</span><span style="color: #aa2211">::</span><span class="n">exec</span><span class="p">(</span><span class="n">protocol</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">return</span></span><span class="bright"> </span><span class="n"><span class="bright">KService</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">Ptr</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="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Just remove the if then. This method becomes a one-liner.</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/D26557#inline-150047">View Inline</a><span style="color: #4b4d51; font-weight: bold;">krun.cpp:956</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: #74777d">//  if there's one...</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><span class="n">runApplication</span><span class="p">(</span><span style="color: #aa2211">*</span><span class="n">service</span><span class="p">,</span> <span class="n">QList</span><span style="color: #aa2211"><</span><span class="n">QUrl</span><span style="color: #aa2211">></span><span class="p">()</span> <span style="color: #aa2211"><<</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_strURL</span><span class="p">,</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_window</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 class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_bFinished</span> <span style="color: #aa2211">=</span> <span style="color: #304a96">true</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">You forgot to pass d->m_asn here (last argument of runApplication).</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/D26557#inline-150046">View Inline</a><span style="color: #4b4d51; font-weight: bold;">krun.cpp:967</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: #74777d">// the scheme has no service or protocol associated</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                <span style="color: #74777d">// use url scheme associated protocol</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">                <span class="n">mimeTypeDetermined</span><span class="p">(</span><span class="n">KProtocolManager</span><span style="color: #aa2211">::</span><span class="n">defaultMimetype</span><span class="p">(</span><span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_strURL</span><span class="p">));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I think what you meant here was scheme-associated *mimetype* ?<br />
or "default mimetype from the protocol file".</p>

<p style="padding: 0; margin: 8px;">In a URL, scheme==protocol, but in KIO we're mostly using the word protocol to refer to those .protocol files. KProtocolInfo::exec() is also reading from the [scheme associated] protocol file so this comment is confusing.</p>

<p style="padding: 0; margin: 8px;">(I wonder if this isn't dead code though - helper protocols don't set an empty exec line and a default mimetype, this would make no sense, only real ioslaves like kio_man set a default mimetype, text/html)</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/D26557#inline-150044">View Inline</a><span style="color: #4b4d51; font-weight: bold;">krun.cpp:971</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> <span style="color: #aa4000">else</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><span class="n">run</span><span class="p">(</span><span class="n">exec</span><span class="p">,</span> <span class="n">QList</span><span style="color: #aa2211"><</span><span class="n">QUrl</span><span style="color: #aa2211">></span><span class="p">()</span> <span style="color: #aa2211"><<</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_strURL</span><span class="p">,</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_window</span><span class="p">,</span> <span class="n">QString</span><span class="p">(),</span> <span class="n">QString</span><span class="p">(),</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_asn</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 class="bright">    </span><span style="color: #aa4000">if</span> <span class="p">(<span class="bright"></span></span><span class="bright"> </span><span class="n">run</span><span class="p">(</span><span class="n">exec</span><span class="p">,</span> <span class="n">QList</span><span style="color: #aa2211"><</span><span class="n">QUrl</span><span style="color: #aa2211">></span><span class="p">()</span> <span style="color: #aa2211"><<</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_strURL</span><span class="p">,</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_window</span><span class="p">,</span> <span class="n">QString</span><span class="p">(),</span> <span class="n">QString</span><span class="p">(),</span> <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_asn</span><span class="p">))</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">                    <span class="n">d</span><span style="color: #aa2211">-></span><span class="n">m_bFinished</span> <span style="color: #aa2211">=</span> <span style="color: #304a96">true</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">remove space before 'run'</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D26557">https://phabricator.kde.org/D26557</a></div></div><br /><div><strong>To: </strong>meven, ervin, ngraham, Frameworks, dfaure<br /><strong>Cc: </strong>dfaure, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>