Bug 312332

Summary: Digikam don't save rename pattern when using regex
Product: digikam Reporter: Philippe <pmiossec>
Component: AdvancedRename-dialogAssignee: Digikam Developers <digikam-bugs-null>
Severity: normal CC: andi.clemens, caulier.gilles
Priority: NOR    
Version: 2.8.0   
Target Milestone: ---   
Platform: Ubuntu Packages   
OS: Linux   
Latest Commit: Version Fixed In: 3.0.0

Description Philippe 2012-12-29 11:58:46 UTC
In the rename file dialog, when you use regex to modify a string, the pattern is not saved in the history of pattern used.

It's due to the presence of commas ',' (ex: [dir]{replace:"^[0-9\\-]*_","",r}) because commas are the separator used to store in the digikam config file (see section "[AdvancedRename Input]", key "Pattern History List=")

For exemple, if you try the pattern :
it will be never saved.

PS : I tried to play a little with modifying directly the config file and it seems there is also a problem with the '\' char...
Comment 1 caulier.gilles 2012-12-29 12:02:24 UTC

I don't take a look how to save Advance Rename settings in config file, but it can be an encoding problem (UTF8) or a bug in KConfig API...

Gilles Caulier
Comment 2 Andi Clemens 2012-12-30 10:04:56 UTC
I'll take a look at this later on...
Comment 3 Andi Clemens 2012-12-30 10:14:11 UTC
Hmm for me the string you provided is saved correctly:

Comment 4 Andi Clemens 2012-12-30 10:17:04 UTC
After saving the pattern several times, it really seems to disappear again. Maybe I need to encode it by myself somehow... will have a look
Comment 5 Andi Clemens 2012-12-30 11:14:15 UTC
Hmm for me nothing is saved in the history list... even simple things like:

I guess it is broken in general, but why? Need to investigate later this evening...

Comment 6 Andi Clemens 2012-12-30 19:00:33 UTC
Git commit 3a1cf66687dbd5845e29f77970107edab9e0359b by Andi Clemens.
Committed on 30/12/2012 at 19:58.
Pushed by aclemens into branch 'master'.

Read pattern history before writing the new values.

The pattern history will not be saved correctly when the AdvancedRename tool is used, but the pattern history in the BQM is not updated.
Therefore closing digiKam will result in an empty pattern history in the config file because the BQM is the last instance that will be destroyed when closing the main application.

This does not fix the problem described in this bugreport, but it is somehow related.

M  +9    -9    utilities/advancedrename/advancedrenameinput.cpp

Comment 7 Andi Clemens 2012-12-30 19:07:28 UTC
Now that my config is saved correctly, I can NOT reproduce the described bug.
The string will be escaped correctly, it will store


in the config file.

Could you please checkout master and compile digiKam yourself to verify the bug? I will mark it as fixed, feel free to reopen if it still doesn't work.

I guess the previous patch might have fixed the issue, so it is not a character problem but a problem of having multiple AdvancedRenameInput widgets in the different digiKam components.
Comment 8 Philippe 2013-01-07 23:55:03 UTC
I thank you a lot for your promptness and for fixing this bug.

But, I discovered the bug on the computer of my mother and won't be able to use it again before quite some long time. And things appart, I could not be even sure to know how to compile digikam too :(

I think I will wait for the next stable release and will reopen the bug if it's not fixed...

Thanks again for all!
Comment 9 Andi Clemens 2013-01-08 07:15:12 UTC
Maybe you can try the following:

Enter the rename pattern in the BQM (select some images and press CTRL+B). Enter it in there and close digiKam. Maybe it will be saved correctly now.

Also try to enter the rename pattern in the config file like this, with characters escaped:


For new rename patterns that might not get saved, try the BQM method. Maybe this helps.