Bug 312332 - Digikam don't save rename pattern when using regex
Summary: Digikam don't save rename pattern when using regex
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: AdvancedRename-dialog (show other bugs)
Version: 2.8.0
Platform: Ubuntu Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-29 11:58 UTC by Philippe
Modified: 2022-02-01 06:40 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 :
[date:"yyyy-MM-dd"]_[dir]{replace:"^[0-9\\-]*_","",r}_[date:"HH-mm-ss"]_###[f].[ext]
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
Andi,

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:
[date:"yyyy-MM-dd"]_[dir]{replace:"^[0-9\\-]*_","",r}_[date:"HH-mm-ss"]_###[f].[ext]

Strange...
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:
aaa_###

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

Andi
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

http://commits.kde.org/digikam/3a1cf66687dbd5845e29f77970107edab9e0359b
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

date:"yyyy-MM-dd"]_[dir]{replace:"^[0-9\\\\\\\\-]*_"\\,""\\,r}_[date:"HH-mm-ss"]_###[f].[ext]

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:

date:"yyyy-MM-dd"]_[dir]{replace:"^[0-9\\\\\\\\-]*_"\\,""\\,r}_[date:"HH-mm-ss"]_###[f].[ext]


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

Andi