Bug 513649 - Unable to Delete files via KWrite when opened with file path
Summary: Unable to Delete files via KWrite when opened with file path
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (other bugs)
Version First Reported In: 25.12.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-21 13:26 UTC by Kath
Modified: 2025-12-21 16:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Video showing delete option not working when Kwrite is launched directly, and the delete working when 'empty' launched & opening a file (3.79 MB, video/webm)
2025-12-21 13:26 UTC, Kath
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kath 2025-12-21 13:26:00 UTC
Created attachment 187844 [details]
Video showing delete option not working when Kwrite is launched directly, and the delete working when 'empty' launched & opening a file

SUMMARY
When opening a file in Kwrite - For example by double clicking a file in Dolphin, or via console, the Files > File Actions > Delete, option will not work.

STEPS TO REPRODUCE
1. Have a test .txt file
2. Open the file in Kwrite
3. Files > File Actions > Delete

Alternative:
1. Open console
2. Open a file with Kwrite and a file path, eg "kwrite <path>"
3. Files > File Actions > Delete

OBSERVED RESULT
The window is closed, but the file is not deleted

EXPECTED RESULT
The file is deleted

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 43
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.17.12-300.fc43.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × Intel® Core™ i9-9900K CPU @ 3.60GHz
Memory: 32 GiB of RAM (31.1 GiB usable)
Graphics Processor: AMD Radeon RX 6800

KWrite Version 25.12.0

Also able to reproduce on another device running Arch

ADDITIONAL INFORMATION
If you Open Kwrite with no file, then manually open a file, the same Files > File Actions > Delete works as expected

Using the "Rename" in the File Actions works as expected

I have experienced this with .json as well as .txt

I have showed a video of this bug, as well as the empty launch & open where it does delete as expected.
(The large "Delete file" dialog is due to a window rule for position / size and unrelated)
Comment 1 Kath 2025-12-21 14:16:15 UTC
I have found if opening multiple files with a multiselect so they open in one window with tabs, the Files > File Actions > Delete will work for all tabs - except for the last one where the window is closed.
Comment 2 Christoph Cullmann 2025-12-21 16:39:45 UTC
The issue is that the code (like for rename) closes the document, that then leads to closing of KWrite (or Kate) if configured that way.
Comment 3 Christoph Cullmann 2025-12-21 16:46:25 UTC
Git commit 637cbd48d4ee12613f8e0f5eec3f0ee477117832 by Christoph Cullmann.
Committed on 21/12/2025 at 16:46.
Pushed by cullmann into branch 'master'.

fix delete of last file open in editor

only try to close the file, if we use closeDocument, we might close the application and never delete stuff

M  +7    -1    apps/lib/katefileactions.cpp

https://invent.kde.org/utilities/kate/-/commit/637cbd48d4ee12613f8e0f5eec3f0ee477117832
Comment 4 Christoph Cullmann 2025-12-21 16:47:59 UTC
rename did already use closeUrl and should be fine.
Comment 5 Christoph Cullmann 2025-12-21 16:48:16 UTC
Thanks for reporting this.