<table><tr><td style="">brauch added inline comments.
</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/D16484">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/D16484#inline-89929">View Inline</a><span style="color: #4b4d51; font-weight: bold;">CMakeLists.txt:2</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);">add_definitions(-DTRANSLATION_DOMAIN=\"kdevscratchpad\")
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">set(scratchpad_SRCS
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    scratchpad.cpp
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">In general I would personally omit this variable step in modern CMake code, there is no reason for it. Just list the sources directly in the command adding the target. If you need them elsewhere, they are easily retrieved with get_target_property().</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/D16484#inline-89932">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpad.cpp:141</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="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">emit</span> <span class="n">actionFailed</span><span class="p">(</span><span class="n">i18n</span><span class="p">(</span><span style="color: #766510">"Failed removing scratch: %1"</span><span class="p">,</span> <span class="n">index</span><span class="p">.</span><span class="n">data</span><span class="p">().</span><span class="n">toString</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></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">"failed to remove"</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/D16484#inline-89935">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpad.cpp:147</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="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QString</span> <span class="n">name</span> <span style="color: #aa2211">=</span> <span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"scratch1.cpp"</span><span class="p">);</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">int</span> <span class="n">i</span> <span style="color: #aa2211">=</span> <span style="color: #601200">2</span><span class="p">;</span> <span style="color: #aa2211">!</span><span class="n">m_model</span><span style="color: #aa2211">-></span><span class="n">findItems</span><span class="p">(</span><span class="n">name</span><span class="p">).</span><span class="n">isEmpty</span><span class="p">();</span> <span style="color: #aa2211">++</span><span class="n">i</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;">This is too C++-specific for a general KDevelop plugin.</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/D16484#inline-89934">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpad.cpp:155</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">file</span><span class="p">.</span><span class="n">close</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></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">else { // handle error }</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/D16484#inline-89933">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpad.cpp:164</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">m_model</span><span style="color: #aa2211">-></span><span class="n">setData</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">previousName</span><span class="p">);</span> <span style="color: #74777d">// undo</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">emit</span> <span style="color: #004012">actionFailed</span><span class="p">(</span><span class="n">i18n</span><span class="p">(</span><span style="color: #766510">"Failed renaming scratch: Names must not include '/'"</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">return</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">failed to rename</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/D16484#inline-89938">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpadjob.cpp:48</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">m_process</span><span style="color: #aa2211">-></span><span class="n">setShellCommand</span><span class="p">(</span><span class="n">substituted</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">setCapabilities</span><span class="p">(</span><span class="n">Killable</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">You need to check whether the command is non-empty, otherwise you create unkillable zombie processes.</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/D16484#inline-89936">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpadjob.cpp:52</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">setStandardToolView</span><span class="p">(</span><span class="n">KDevelop</span><span style="color: #aa2211">::</span><span class="n">IOutputView</span><span style="color: #aa2211">::</span><span class="n">RunView</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">setTitle</span><span class="p">(</span><span class="n">i18n</span><span class="p">(</span><span style="color: #766510">"scratch:%1"</span><span class="p">,</span> <span class="n">item</span><span style="color: #aa2211">-></span><span class="n">text</span><span class="p">()));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I think the i18n calls with the word "scratch" need a context, otherwise translators will not know what's going on 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/D16484#inline-89937">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpadjob.cpp:62</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">m_process</span><span style="color: #aa2211">-></span><span class="n">setOutputChannelMode</span><span class="p">(</span><span class="n">KProcess</span><span style="color: #aa2211">::</span><span class="n">MergedChannels</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">connect</span><span class="p">(</span><span class="n">m_process</span><span class="p">,</span> <span style="color: #aa4000">static_cast</span><span style="color: #aa2211"><</span><span style="color: #aa4000">void</span><span class="p">(</span><span class="n">KProcess</span><span style="color: #aa2211">::*</span><span class="p">)(</span><span style="color: #aa4000">int</span><span class="p">,</span> <span class="n">QProcess</span><span style="color: #aa2211">::</span><span class="n">ExitStatus</span><span class="p">)</span><span style="color: #aa2211">></span><span class="p">(</span><span style="color: #aa2211">&</span><span class="n">KProcess</span><span style="color: #aa2211">::</span><span class="n">finished</span><span class="p">),</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa4000">this</span><span class="p">,</span> <span style="color: #aa2211">&</span><span class="n">ScratchpadJob</span><span style="color: #aa2211">::</span><span class="n">processFinished</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><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);">QOverload<int, QProcess::ExitStatus>::of(&KProcess::finished)</pre></div></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/D16484#inline-89939">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpadjob.cpp:92</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">qCDebug</span><span class="p">(</span><span class="n">PLUGIN_SCRATCHPAD</span><span class="p">)</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"process encountered error"</span> <span style="color: #aa2211"><<</span> <span class="n">error</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">outputModel</span><span class="p">()</span><span style="color: #aa2211">-></span><span class="n">appendLine</span><span class="p">(</span><span class="n">i18n</span><span class="p">(</span><span style="color: #766510">"Process encountered error: %1."</span><span class="p">,</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">                                   <span class="n">QLatin1String</span><span class="p">(</span><span class="n">QMetaEnum</span><span style="color: #aa2211">::</span><span class="n">fromType</span><span style="color: #aa2211"><</span><span class="n">QProcess</span><span style="color: #aa2211">::</span><span class="n">ProcessError</span><span style="color: #aa2211">></span><span class="p">().</span><span class="n">valueToKey</span><span class="p">(</span><span class="n">error</span><span class="p">))));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This is always an internal error, i.e. this plugin doing something wrong. I think it should be presented to the user as such.</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/D16484#inline-89940">View Inline</a><span style="color: #4b4d51; font-weight: bold;">scratchpadview.cpp:176</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">auto</span> <span class="n">config</span> <span style="color: #aa2211">=</span> <span class="n">KSharedConfig</span><span style="color: #aa2211">::</span><span class="n">openConfig</span><span class="p">()</span><span style="color: #aa2211">-></span><span class="n">group</span><span class="p">(</span><span style="color: #766510">"Scratchpad"</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">config</span><span class="p">.</span><span class="n">writeEntry</span><span class="p">(</span><span style="color: #766510">"command"</span><span class="p">,</span> <span class="n">commandWidget</span><span style="color: #aa2211">-></span><span class="n">text</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></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">probably the command should be per scratch ...?</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D16484">https://phabricator.kde.org/D16484</a></div></div><br /><div><strong>To: </strong>amhndu<br /><strong>Cc: </strong>brauch, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>