Bug 413473

Summary: Kile complains about failure and deletes file if one tries to overwrite an existing template.
Product: [Applications] kile Reporter: Kishore Gopalakrishnan <kishore96>
Component: user interfaceAssignee: Michel Ludwig <michel.ludwig>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 2.9.93   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot of the error message.

Description Kishore Gopalakrishnan 2019-10-26 13:23:02 UTC
Created attachment 123492 [details]
Screenshot of the error message.

SUMMARY
If we try to overwrite (through File > Create template from document) a previously created user template, Kile claims that creation failed and then deletes the file the user used to create the template. However, the template modification actually succeeds.

STEPS TO REPRODUCE
1. Create a template.
2. Create a new .tex document using this template and make some changes in it.
3. File > Create template from document.
4. Choose to overwrite the existing template.

OBSERVED RESULT
Kile throws up an error saying 'failed to create template' (see attached screenshot). Once we dismiss the error, it then complains that the file has been deleted by another program. However, if we check the modified template by creating a new document, we find that the changes we made have actually been applied to the template, contrary to what the error message claimed.

EXPECTED RESULT
Kile should not falsely claim template creation failed. It should also not delete the document the user used to create the template.

SOFTWARE/OS VERSIONS
Linus distro: Arch Linux
KDE Plasma Version: 5.17.0
KDE Frameworks Version: 5.63.0
Qt Version: 5.13.1

ADDITIONAL INFORMATION
If we try to create a new template (using a previously nonexistent template name), it succeeds and does not delete the document used, as expected.
Comment 1 Michel Ludwig 2019-12-01 14:57:04 UTC
Git commit 7a55cf2d93c9daa13f2fa2ec1ae25646507cfc0c by Michel Ludwig.
Committed on 01/12/2019 at 14:56.
Pushed by mludwig into branch 'master'.

Fix overriding of existing templates

Also, don't delete the original file after the template has been
created from it.

M  +3    -4    src/dialogs/managetemplatesdialog.cpp
M  +5    -73   src/templates.cpp
M  +4    -6    src/templates.h

https://commits.kde.org/kile/7a55cf2d93c9daa13f2fa2ec1ae25646507cfc0c