Bug 481561

Summary: No error message when renaming fails
Product: [Applications] dolphin Reporter: Jin Liu <ad.liu.jin>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: fanzhuyifan, kfm-devel
Priority: NOR Keywords: qt6
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Jin Liu 2024-02-20 01:04:06 UTC
STEPS TO REPRODUCE
1. Select a file.
2. Press F2.
3. Enter a very long file name (longer than 255 chars)

OBSERVED RESULT
No error message

EXPECTED RESULT
Dolphin tells me that renaming failed.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600H with Radeon Graphics
Memory: 13.5 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Comment 2 fanzhuyifan 2024-02-20 04:56:30 UTC
Humm I get the error message on source build of dolphin, btrfs, arch linux. However after the error message is shown the displayed name incorrectly shows the new name, instead of the old name.
Comment 3 Jin Liu 2024-02-20 05:52:00 UTC
(In reply to fanzhuyifan from comment #2)
> Humm I get the error message on source build of dolphin, btrfs, arch linux.
> However after the error message is shown the displayed name incorrectly
> shows the new name, instead of the old name.

I've seen that, too.

Try to create a file "a", and rename it to "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" (300 chars). No errors on master.
Comment 4 Bug Janitor Service 2024-10-11 04:51:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/838
Comment 5 Jin Liu 2024-10-12 11:55:58 UTC
Git commit c5238c9946805c8aef69f4b52689ba5a700c913e by Jin Liu.
Committed on 11/10/2024 at 11:43.
Pushed by meven into branch 'master'.

dolphinview: add error message when renaming failed in dialog mode

M  +3    -0    src/views/dolphinview.cpp

https://invent.kde.org/system/dolphin/-/commit/c5238c9946805c8aef69f4b52689ba5a700c913e
Comment 6 Jin Liu 2024-10-12 14:02:56 UTC
Git commit 829e0eb912a5681d5c6fddfd461165ae9f5cb093 by Jin Liu.
Committed on 12/10/2024 at 13:17.
Pushed by meven into branch 'master'.

KFileItemModel: fix `setData` in the renaming usage

The `setData` function is used by inline renaming to
update the `text` role (i.e. file name) in the model
before actually do the renaming.

However, the current implementation only updates `text`
and url in KFileItem in this case, leaving the `url` role
and the `m_items` cache untouched. This makes the cache
incoherent, so `index()` won't find the renamed item. It
also makes the `url` role incoherent with the `text` role.

This also fixes the problem mentioned in bug #481561
where when inline renaming fails, it still shows the new
name. (Because `m_model->index` fails to find the new name
and rename it back on job failure.)

M  +8    -1    src/kitemviews/kfileitemmodel.cpp

https://invent.kde.org/system/dolphin/-/commit/829e0eb912a5681d5c6fddfd461165ae9f5cb093