Bug 509244

Summary: Tellico does not clean up unused images written to disk
Product: [Applications] tellico Reporter: Robby Stephenson <robby>
Component: generalAssignee: Robby Stephenson <robby>
Status: RESOLVED FIXED    
Severity: normal CC: louise.ripley
Priority: NOR    
Version First Reported In: 4.1.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 4.2
Sentry Crash Report:

Description Robby Stephenson 2025-09-07 18:27:03 UTC
Breaking out from #508902:

STEPS TO REPRODUCE
1. Create a new book collection
2. Save the collection. For example, to the location "~/tellico/books.tc"
3. Settings => Configure Tellico...:
   Reopen file at startup: enable
   Image Storage Options: Store images in directory relative to data file
4. Save settings. Close and reopen tellico.
5. Add a book with a cover:
   Add entry from "Internet Search..."
   Search "2-84565-200-3"
   Search type: ISBN
   Search source: Open Library
6. Add the entry to the collection, save the collection, then remove it from the collection.

The associated cover is not deleted from the location "~/tellico/books_files/".
Comment 1 Robby Stephenson 2025-09-07 18:58:18 UTC
Git commit a6af33ae23bf9803b50435ef2192454e29f26edb by Robby Stephenson.
Committed on 07/09/2025 at 18:55.
Pushed by rstephenson into branch 'master'.

Remove images from local directory when entry values are changed

When the collection is saved, check on which image values were changed
and if any were removed, delete the image from the disk. Since multiple
data files could share the same images in the common application
directory, this behavior only applies to "Store images in directory
relative to data file" option.
FIXED-IN: 4.2

M  +4    -0    ChangeLog
M  +10   -0    src/collection.cpp
M  +7    -0    src/collection.h
M  +11   -0    src/document.cpp
M  +41   -37   src/entry.cpp
M  +1    -1    src/entry.h
M  +34   -11   src/tests/documenttest.cpp

https://invent.kde.org/office/tellico/-/commit/a6af33ae23bf9803b50435ef2192454e29f26edb