Bug 447010 - Documents created from templates unexpectedly reuse template's metadata such as total editing time, created/modified date, revision number
Summary: Documents created from templates unexpectedly reuse template's metadata such ...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 5.0.0-beta5
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-15 02:34 UTC by tomtomtomreportingin
Modified: 2023-03-07 19:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomtomtomreportingin 2021-12-15 02:34:37 UTC
SUMMARY
Documents created from relatively recently generated templates will not start with an editing time of 0, instead using (I assume) the editing time of the template file.

STEPS TO REPRODUCE
1. Create a new document from the template "Animation-Japanese-En".
2. Observe total editing time in File -> Document Information.

OBSERVED RESULT
Total editing time is 26 minutes even though it should be a new document.

EXPECTED RESULT
Total editing time should be 0 seconds since it's a new document.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian sid
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.88.0
Qt Version: 5.12.11 (appimage)

ADDITIONAL INFORMATION
It does not seem to occur with older templates.
Comment 1 tomtomtomreportingin 2022-01-01 01:43:49 UTC
Additionally, documents created from templates also reuse other metadata such as created/modified date and revision number. I've changed the title of the bug report to account for this.
Comment 2 Stephen Wilson 2022-01-17 05:06:19 UTC
This bug also effects the new recording features when the user creates a new image from a template. Snapshots are recorded to a folder based off the document creation date.
Comment 3 Stephen Wilson 2022-05-07 01:58:34 UTC
(In reply to zera@zeragamba.ca from comment #2)
> This bug also effects the new recording features when the user creates a new
> image from a template. Snapshots are recorded to a folder based off the
> document creation date.

Workaround for this is to start a new document from template, clear the document metadata, save it, close, then reopen
Comment 4 Stephen Wilson 2023-03-06 01:27:24 UTC
Still an issue in 5.1.0 :(

Any chance this can be looked at, or at least some pointers as to where to look to see if I can patch it myself?

My idea on patching this issue was the following:
- On open file
- if was opened as template,
- reset created and modified dates to current timestamp
- reset revision number to 0
- reset editing time to 0
- ensure recording folder is updated to new timestamp
Comment 5 Halla Rempt 2023-03-06 09:30:34 UTC
I'm sorry, but we have so many open bugs that it's to promise anything. The template code is also pretty old and gnarly. Probably the best starting point to look into the issue would be void KisPart::openTemplate(const QUrl &url) -- that already resets a couple of things on the document, and it might be possible to fix the issue in the if (ok) { block.
Comment 6 Stephen Wilson 2023-03-07 04:06:49 UTC
Oh hey, that's exactly what i needed.

Looks like it's a one line addition in KisPart::openTemplate:
document->documentInfo()->resetMetaData();

I'll have a look into how to submit this fix :)
Comment 7 Stephen Wilson 2023-03-07 04:56:55 UTC
MR opened: https://invent.kde.org/graphics/krita/-/merge_requests/1769