<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 />



<table bgcolor="#e0e0e0" width="100%" cellpadding="12" style="border: 1px gray solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>
   <h1 style="margin: 0; padding: 0; font-size: 10pt;">This change has been discarded.</h1>
  </td>
 </tr>
</table>
<br />


<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 22, 2016, 10:09 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>