<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/128471/">https://git.reviewboard.kde.org/r/128471/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On July 21st, 2016, 9:52 p.m. UTC, <b>David Faure</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Did you check if knewfilemenutest still passes?</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I see that it's not testing the properties dialog case, I'm working on that.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">(Maybe it would have been easier to split this into 3 different commits & review requests, if the bugs are completely unrelated. Then we could also discuss how to unittest each fix.)</p></pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">knewfilemenutest passes successfully.</p>
<blockquote style="text-rendering: inherit;padding: 0 0 0 1em;border-left: 1px solid #bbb;white-space: normal;margin: 0 0 0 0.5em;line-height: inherit;">
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Maybe it would have been easier to split this into 3 different commits & review requests, if the bugs are completely unrelated.</p>
</blockquote>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Yes the three bugs are pretty much unrelated so have created 3 review requests for them.</p></pre>
<br />







<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On July 21st, 2016, 9:52 p.m. UTC, <b>David Faure</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  


<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://git.reviewboard.kde.org/r/128471/diff/5/?file=472093#file472093line497" style="color: black; font-weight: bold; text-decoration: underline;">src/filewidgets/knewfilemenu.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 5)

    </span>
   </th>
  </tr>
 </thead>



 
 

 <tbody>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">463</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">QObject</span><span class="o">::</span><span class="n">connect</span><span class="p">(</span><span class="n">dlg</span><span class="p">,</span> <span class="n">SIGNAL</span><span class="p">(</span><span class="n">applied</span><span class="p">()),</span> <span class="n">q</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">_k_slotOtherDesktopFile</span><span class="p">()));</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I don't follow. Doesn't removing this connect, break the case of desktop files not from a resource (usingTemplate == false)? Nothing happens anymore when clicking OK, executeStrategy() -- which is where the copying happens -- isn't called anymore.</p></pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">When clicking OK the signal QDialog::accepted  is also emitted. In KPropertiesDialog::init this signal is connected to KPropertiesDialog::slotOk which, first calls the method for writing the desktop file and then emits signal KPropertiesDialog::propertiesClosed and KPropertiesDialog::applied.
In other words files are written first(if any) and then signals are emitted. This means the desktop file will be created even without any connect statement.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Though KNewFileMenu::executeStrategy handles file operations but because of the statement (which is at the start):
<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">if (src.isEmpty()) {
  return;
}</em>
the function returns as m_src is not set.
Also the copying of application desktop file is handled by KPropertiesDialog. So the call to KNewFileMenu::executeStrategy is not needed.</p></pre>
<br />




<p>- Chinmoy</p>


<br />
<p>On July 21st, 2016, 4:30 p.m. UTC, Chinmoy Ranjan Pradhan wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>

<div>Review request for KDE Frameworks and David Faure.</div>
<div>By Chinmoy Ranjan Pradhan.</div>


<p style="color: grey;"><i>Updated July 21, 2016, 4:30 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kio
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This patch fixes couple of issues with KNewFileMenu.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Fix 1: When creating a new file, if a file with the default name already exist then a new name is suggested by <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">KIO::suggestName</em>. Now this works fine until the scheme of file's url is "file" but in case the scheme is "desktop" (<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">like when the url in dolphin is set to desktop:/ or "Folder View Settings > Location" is set to desktop:/</em>) then the check for file's existence fails because <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">QFile::exists</em> doesn't understand the "desktop" scheme. So <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">KIO::suggestName</em> is not called and no new filename is suggested in case a file with the same filename already exist. To fix this i used <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">KNewFileMenuPrivate::mostLocalUrl</em> in <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">KNewFileFileMenu::executeRealFileorDir</em> which will resolve "desktop:/" to the user's desktop path. </p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Fix 2: If a user tries to create a new file and proceeds with the default filename then the file created will have no extension. This happens (<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">inside KNewFileFileMenu::executeRealFileorDir</em>) because the filename is read from the <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">Name</em> section of the desktop file. To fix this, read the URL(the url is in <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">templatePath</em>) from the desktop file, determine the file extension from there and append it in the filename.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Fix 3: Fix for the bug https://bugs.kde.org/show_bug.cgi?id=363673 . The bug occurs because KPropertiesDialog is initialized (<em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">inside KNewFileMenuPrivate::executeOtherDesktopFile</em>) with path of a resource file. Now KPropertiesDialog only show properties if the file is a local file(i guess). Thats why  clicking on "Link to Application" and then clicking 'ok' shows an error message . To Fix this i used QTemporaryFile to copy the contents of the application template shipped with kio and then initialize KPropertiesDialog with the temporary files' path.
(I added KNewFileMenuPrivate::mostLocalUrl here to ensure new filename is suggested when inside "desktop:/".)
(The temporary file created here must be deleted so i also added QFile::remove to <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">_k_slotOtherDesktopFile and _k_slotAbortDialog</em> so that whether or not the user creates a Link to Application, the temporary is always deleted)</p></pre>
  </td>
 </tr>
</table>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/filewidgets/knewfilemenu.cpp <span style="color: grey">(2e613b1)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/128471/diff/" style="margin-left: 3em;">View Diff</a></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments </h1>


 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/07/18/d01841f8-08e3-4609-bd82-b54ea446cdf5__linktoapplication.png">linktoapplication.png</a></li>

 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/07/18/fbd04e13-c2d3-4acc-a4dc-b4a9053e2cb6__newfile.png">no extension and no new filename</a></li>

 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/07/18/6cbb3f10-9513-478b-a865-9fc791c006d5__linktoapplication_afterpatch.png">after_patch</a></li>

 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/07/18/2e9f5fa5-eaaa-4abc-a0ac-f492fb01faa3__newfile_aftepatch.png">after_patch</a></li>

 <li><a href="https://git.reviewboard.kde.org/media/uploaded/files/2016/07/21/1e115e07-3546-4abe-b913-9e841c21f672__new_addition.png">add new device menu</a></li>

</ul>




  </td>
 </tr>
</table>







  </div>
 </body>
</html>