Bug 193874 - When changing dates, change date-based filename as well.
Summary: When changing dates, change date-based filename as well.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Date (show other bugs)
Version: 2.6.0
Platform: Ubuntu Unspecified
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-24 13:11 UTC by Dotan Cohen
Modified: 2017-08-12 06:41 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.6.0
Sentry Crash Report:


Attachments
Example (55.18 KB, image/png)
2011-12-17 17:10 UTC, Dotan Cohen
Details
Patch for bug 193874 (3.84 KB, patch)
2012-03-20 15:14 UTC, Smit Mehta
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dotan Cohen 2009-05-24 13:11:04 UTC
Version:            (using KDE 4.2.3)
Installed from:    Ubuntu Packages

Digikam gives the user the option to change filenames to date-based. In these cases, it is obvious that the user is using the filename as a date field. Therefore, when the user changes the date of a photo, he should have the option of changing date-based filenames as well.
Comment 1 caulier.gilles 2011-12-17 09:31:14 UTC
Dotan,

This file still valid using 2.x serie ?

Also, please give more information about, it's not enough clear...

Gilles Caulier
Comment 2 Dotan Cohen 2011-12-17 17:10:54 UTC
Created attachment 66835 [details]
Example

Yes, the RFE is still valid for Digikam 2.4.

If there is a file that is named 20111126T160302.jpg that has the timestamp 2011-11-26 16:03:02 then obviously the filename is used to record the date of the image, in addition to XMP, IPTC, or anything else. Therefore, when changing the time of the photo the filename should be an option to update as well. See attached screenshot.

Thanks!
Comment 3 Smit Mehta 2012-03-13 08:51:03 UTC
Hi

I am Smit, an aspiring GSoC applicant for the UPnP plugin, under Marcel. I was interested to solve this bug. As guided by Marcel, the advanced rename is implemented in /utilities/advancedrename and the "date and time adjust" is implemented as a kipi-plugin. Where can i find the kipi-plugin code? Can any developer please guide me on how to go about solving this?

Smit
Comment 5 Smit Mehta 2012-03-14 09:10:52 UTC
Hi Gilles

Thanks for pointing out the code. I tried to make ammends to it. As the user wants, i included a "Edit Filename" option in the list of exiting ones, and in the SlotOk(), i wrote another if condition, to do stuff when it is checked. I want to change the file name. However whatever function i use, i am unable to change it. I can change all the data related to image, say its comments, tags, etc. But not the name. Kindly go through the patch and comment.

<a href="http://pastebin.com/AcdF4kdn"> patch </a>

Smit
Comment 6 Marcel Wiesweg 2012-03-18 20:45:29 UTC
You need to start an actual file rename operation on disk, not something which adjusts parameters on a structure in memory. 
I suggest to use KIO::move().
Regarding your code:
Remove the toAscii(). Dont forget to find out the correct file suffix, see QFileInfo::suffix or completeSuffix(). Dont forget to handle a possible XMP sidecar file (current work in progress under bug 220545). For this and the KIO code, I suggest you have a look at digikam's dio.cpp
Comment 7 Smit Mehta 2012-03-19 17:20:27 UTC
Hi Gilles

Kindly review the given patch.

http://pastebin.com/ERRUtBtH

This changed code works properly on the source code i downloaded on March 11. In that version, whenever i changed the file name with that option, upon clicking "Ok", it changed the filename, and was shown with the new name in the album view. But in the source-code i downloaded today, i.e. March 19, it still changes the fill name, but it is no more there in the album view inside digikam. Any suggestions?
Comment 8 Smit Mehta 2012-03-19 17:30:21 UTC
Hi

Kindly note that, when i say the patch works in the 11th March's version of digikam, i mean that the file renaming portion works properly (as the sidecar implementation in kpmetadata was not done then). It renamed the file, and digikam automatically updated the view, with the renamed file. But it is not happening in the current source code.
Instead, it is not showing the renamed file at all.

Smit
Comment 9 caulier.gilles 2012-03-20 12:06:41 UTC
Smit,

1/ please post patch as attached file to this bugzilla entry, not as an external link

2/ to rename XMP sidecar file, please use KPMetadata::moveSidecar() static method that i just add today.

3/ revise you patch against current git/master implementation

Thanks in advance

Gilles
Comment 10 Smit Mehta 2012-03-20 15:14:15 UTC
Created attachment 69764 [details]
Patch for bug 193874
Comment 11 Smit Mehta 2012-03-20 15:15:29 UTC
Hi Gilles

I have incorporated the changes you recommended in my patch. It is working properly on the latest source code. Kindly review it.

Smit
Comment 12 caulier.gilles 2012-03-24 15:08:03 UTC
smit,

Patch sound fine for me.

Do you have an account to apply it on git/master ?

Best

Gilles Caulier
Comment 13 Smit Mehta 2012-03-24 16:11:47 UTC
Hi Gilles

No I dont have an account to apply it on git/master. Can I use your name in "Who supports this request?" part of the application? Could you please guide me on how to get that?

Smit
Comment 14 Smit Mehta 2012-03-25 17:33:55 UTC
Hi

I am closing this bug. This commit solves it.

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/3d7d8f30f1e9771dc1aab18b1b1a01b86883a946

Smit
Comment 15 caulier.gilles 2012-03-25 17:49:41 UTC
Smit,

Note, use BUGS not BUG to close file automatically

Use CCBUGS, not CCBUG to copy commit message in bugzilla entry

Best

Gilles Caulier