Bug 506620

Summary: Renaming options only seem to persist if more than 1 image is selected
Product: [Applications] digikam Reporter: Roland <carbonwerkes>
Component: AdvancedRename-dialogAssignee: Digikam Developers <digikam-bugs-null>
Status: REPORTED ---    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 8.8.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Roland 2025-07-05 08:43:54 UTC
***

***

SUMMARY
If in a folder I have say 6 photos, and I select all via Ctrl-A and then hit F2 for renaming, I can configure via the Renaming Options a template like [dir] #. And this works fine. If I cancel, and select 1 photo, and hit F2, the defined template is gone. If I select 2 or more photos and hit F2, the template is recovered. Same happens if I jump folders in the tree.

STEPS TO REPRODUCE
1. As outlined, select > 1 image in a folder
2. Hit F2 for rename
3. In the renaming pattern dialog box, use something like [dir] #
4. Hit OK. All files selected are renamed
5. Repeat except select only 1 photo. Hit F2, and the template is not persisted. Select > 2 photos from this or another folder and hit F2 and the template is defaulted again.

OBSERVED RESULT
Template defined for the renaming pattern is not persisted if only 1 photo is selected. 

EXPECTED RESULT
Presumably, since this is a simple rename dialog function, it should behave consistently if 1 or 300 photos are selected for rename. 

SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Seems like a simple logical check is in place where the rename template is only recovered and set as default if >1 image is selected. But often, if Im consolidating a folder structure for an event, there may only be 1 photo in a folder, or only 1 where the name needs to be updated. So, I dont see any advantage to not having this be consistent if 1 vs >1 images are selected for rename
Comment 1 caulier.gilles 2025-07-05 10:28:51 UTC
Tested under MacOS and behavior is fully reproducible with 8.7.0...
Comment 2 Maik Qualmann 2025-07-05 10:38:54 UTC
I remember this being reported as a bug before. But it's intentional.
Individual renames aren't meant to flood the rename history.
As I said, it was definitely programmed that way.
Gilles, if you want to change it, just say so.

Maik
Comment 3 Roland 2025-07-05 11:10:35 UTC
Im not following. If I have to manually select from the history pulldown the template to apply, and that is the most recent template, it doesnt add additional history entries. In fact, it doesnt change the order of history- it seems to simply identify that the template exists in history, so any further history op is aborted. Shouldnt the history box reflect the order of template use as most recent to least?

Regardless, in any context- if I pull down history, or paste in the template manually from the clipboard, or recreate it manually, the net result is the same- no change to the history pulldown. Worse, the case where there is an addition is if I get the template wrong. There doesnt seem to be an easy way to delete a template usage from the history list (at least not in that modal window), so seems to be having one that is not wanted simply adds more chance for inconsistency.
Comment 4 Maik Qualmann 2025-07-05 11:34:34 UTC
No history is saved for a single image. It's only added to the history after two or more images.

In my workflow, it's actually the case that my individual renaming is usually drastically different from group renaming, and I don't need it in the history. This behavior was probably even requested as a bug report.

Developing an option to delete history entries is something to consider.

Maik
Comment 5 caulier.gilles 2025-07-05 11:47:55 UTC
Maik talk probably of this entry closed as INTENTIONAL : https://bugs.kde.org/show_bug.cgi?id=462825
Comment 6 Roland 2025-07-05 12:16:19 UTC
Perhaps a better approach then would be to include a checkbox to the left of the template/rename box, where you have a conventional rename box and the existing variant, with one or the other hidden based on the state of the check box. Simply force the checkbox to selected if multiple files were selected. The checkmark could just be 'Template Mode' or something like that...
Comment 7 Maik Qualmann 2025-07-05 13:25:05 UTC
This is the then Bug 211060. Andi Clemens explained the single filename in a comment at https://bugs.kde.org/show_bug.cgi?id=211060#c8

And here is the code:

https://invent.kde.org/graphics/digikam/-/blob/master/core/utilities/advancedrename/advancedrenamedialog.cpp?ref_type=heads#L330

Here the pattern is deleted so that it is not included in the history:

https://invent.kde.org/graphics/digikam/-/blob/master/core/utilities/advancedrename/advancedrenamedialog.cpp?ref_type=heads#L362

And no, no additional option to complicate things even further. It's either/or.

Maik
Comment 8 Roland 2025-07-05 14:24:26 UTC
Well, as I see it, there isnt anything wrong with the history approach per se. The problem with the implementation is that its not listed as most recent. It is listed as chronological- as a function of when that pattern was created. So, re-using it for a single image doesnt move that pattern to the top of the history box, which is not at all typical for a file history/recents implementation. And so looking through a list of potentially similar patterns, especially if you have a single image in a directory where you dont have reference to the 'standard' being used for that branch or tree, seems like it could be more user friendly. Could the history box be sorted by last used, so that it is more like a recents/history vs something like an alphabetical listing of export formats etc?
Comment 9 Maik Qualmann 2025-07-05 18:54:42 UTC
I think I'm misunderstanding something. The most recently used renaming pattern is always at the top. If you select and apply a pattern from the middle of the list, that pattern will be first in the next renaming.

Maik
Comment 10 Roland 2025-07-06 08:13:28 UTC
Well, I dont know if you are misunderstanding anything- but perhaps for whatever reason we arent seeing the same result.

It is possible there is a bug where if there are 10 entries in history, it simply stops appending or reordering. 

In my instance, I have exactly 10 items in the history list, which I believe is the hard-coded limit. If I create some new pattern, it isnt added to the list. If I hit F2 for a single file, and select say, Item 3, from the list, annd OK that, the list on next access doesnt show former item 3 as item 1- it remains as item 3 in the list. 

I dont see a way in the dialog box, or in the System-wide Settings, to either clear this history, or to configure it to shed items from the list etc.

So yea, perhaps there is just some weird thing going on with history once 10 items are persisted.

R