[kio] Some fixes for KNewFileMenu.

Review Request #128471 - Created July 16, 2016 and discarded

Information
Chinmoy Ranjan Pradhan
kio
master
Reviewers
kdeframeworks
dfaure

This patch fixes couple of issues with KNewFileMenu.

Fix 1: When creating a new file, if a file with the default name already exist then a new name is suggested by KIO::suggestName. Now this works fine until the scheme of file's url is "file" but in case the scheme is "desktop" (like when the url in dolphin is set to desktop:/ or "Folder View Settings > Location" is set to desktop:/) then the check for file's existence fails because QFile::exists doesn't understand the "desktop" scheme. So KIO::suggestName is not called and no new filename is suggested in case a file with the same filename already exist. To fix this i used KNewFileMenuPrivate::mostLocalUrl in KNewFileFileMenu::executeRealFileorDir which will resolve "desktop:/" to the user's desktop path.

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 (inside KNewFileFileMenu::executeRealFileorDir) because the filename is read from the Name section of the desktop file. To fix this, read the URL(the url is in templatePath) from the desktop file, determine the file extension from there and append it in the filename.

Fix 3: Fix for the bug https://bugs.kde.org/show_bug.cgi?id=363673 . The bug occurs because KPropertiesDialog is initialized (inside KNewFileMenuPrivate::executeOtherDesktopFile) 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 _k_slotOtherDesktopFile and _k_slotAbortDialog so that whether or not the user creates a Link to Application, the temporary is always deleted)


  

Files


Issues

  • 0
  • 7
  • 1
  • 8
Description From Last Updated
Chinmoy Ranjan Pradhan
Chinmoy Ranjan Pradhan
David Faure
Chinmoy Ranjan Pradhan
Chinmoy Ranjan Pradhan
Chinmoy Ranjan Pradhan
Chinmoy Ranjan Pradhan
David Faure
Chinmoy Ranjan Pradhan
Review request changed

Status: Discarded

Loading...