Bug 422638 - Old filename retained in documentinfo.xml after "Save As"
Summary: Old filename retained in documentinfo.xml after "Save As"
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.3.0-beta2
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Tiar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-08 15:31 UTC by Dive Nex
Modified: 2020-09-01 20:08 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dive Nex 2020-06-08 15:31:54 UTC
SUMMARY

The original filename, not the new one, is retained inside documentinfo.xml after "Save As"

STEPS TO REPRODUCE

1. Create a file dog.kra
2. Save to a different name cat.kra using "Save As..."
3. Make some changes to the drawing
4. Try to close Krita

OBSERVED RESULT

A dialogue appears asking "The document 'dog' has been modified. Do you want to save it?" although no 'dog' file is currently open.

EXPECTED RESULT

The dialogue should ask "The document 'cat' has been modified. Do you want to save it?"

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION

The file documentinfo.xml still contains <title>Dog</title> instead of Cat.

I assume this is a bug and not an intended behaviour as it would be very confusing. One may ask "No" to the save request, given that it requests to save a different file, not the opened one.
Comment 1 wolthera 2020-06-08 15:33:10 UTC
It is intended behaviour, it's because we cannot tell reliably whether or not the title has changed.
Comment 2 Dive Nex 2020-06-08 15:43:22 UTC
Thanks for the prompt reply.

If the title inside documentinfo.xml really needs to remain unchanged (I am not sure I understand why), then the proper fix of this bug would be *not* to read the file name from documentinfo.xml, but from the file system, when requesting the user if they want to save the changes to their file. 

For sure, if I am editing the file "cat.kra", it does not make sense to be asked if I want to save changes to "dog.kra", just because at some point in the past I created a file with that name. This can lead to data loss.
Comment 3 Halla Rempt 2020-06-08 15:52:41 UTC
It's a longstanding issue -- I think there's another report, by deevad about it. It comes from Krita's heritage as part of KOffice, where the title of a document and the filename of the document can be different. But when asking whether a document should be saved, we should use the filename.
Comment 4 Dive Nex 2020-06-08 16:37:00 UTC
Thanks for the explanation. It makes sense. And thank you for your work on Krita. It's such a great program!
Comment 5 Tiar 2020-08-01 20:06:57 UTC
Git commit 98ed8547abb7af01d926cb8d27b104c03dd6a3c3 by Agata Cacko.
Committed on 01/08/2020 at 20:06.
Pushed by tymond into branch 'master'.

Don't use document title when warning about unsaved changes

Before this commit, Krita would use document title
(which is usually the filename that was first used
for that document without the extension).
That would cause a confusion when "Save As" feature is used
since Krita would stll hold the old name as the document title.
This commit changes it to always use the filename instead
(in the unsaved changes warning dialog).

M  +1    -5    libs/ui/KisView.cpp

https://invent.kde.org/graphics/krita/commit/98ed8547abb7af01d926cb8d27b104c03dd6a3c3
Comment 6 Tiar 2020-09-01 20:08:36 UTC
Git commit 1024e8c32750fd4043b21fa8222a071e4ee56c50 by Agata Cacko.
Committed on 01/09/2020 at 19:35.
Pushed by tymond into branch 'krita/4.3'.

Don't use document title when warning about unsaved changes

Before this commit, Krita would use document title
(which is usually the filename that was first used
for that document without the extension).
That would cause a confusion when "Save As" feature is used
since Krita would stll hold the old name as the document title.
This commit changes it to always use the filename instead
(in the unsaved changes warning dialog).

M  +1    -5    libs/ui/KisView.cpp

https://invent.kde.org/graphics/krita/commit/1024e8c32750fd4043b21fa8222a071e4ee56c50