[digikam] [Bug 261417] Duplicate image counter is not adjusted when removing a duplicate

Mario Frank bugzilla_noreply at kde.org
Mon Nov 21 16:34:10 GMT 2016


--- Comment #21 from Mario Frank <mario.frank at uni-potsdam.de> ---
(In reply to Mario Frank from comment #20)
> (In reply to caulier.gilles from comment #19)
> > 
> > Well, it's simple. If one image can be present in more than one SAlbum, all
> > relevant SAlbum must be updated through DuplicatesFinder tool.
> > 
> > CoreDb class can be your friend here. But as i can see the relevant method
> > is missing about search album.
> > 
> Okay, I'll try to get that done.
> > Another question : In avanced search tool, we can show items relevant of
> > complex DB queries. What's happen when i delete an item from a SAlbum in
> > this view ?
> I will have to look at the code.
> Thanks for the hints.

Hey Gilles,

The queries of advanced searches do not contain any image ids, the search
should not have to be updated. Was this what you wanted to know?

Nevertheless, I crawled through the source code and have a working solution. 
Since I am not sure if it is the best way to solve that point, I will describe
the approach more closely to make my thoughts clear.

If some image (or some images) is deleted, I have to find out whether this
image is part of a duplicates search. I will come to the way back later.
The easiest way is to get all SAlbums that have DuplicateSearch as type.
Filtering them out is easy. Since I wanted to create reusable code, I created a
function that is able to filter all SAlbums by type. I could do that
in-database. But since the SAlbums are already present in the AlbumManager, the
functionality is located best there. Then I get all SAlbums that represent the
duplicate search, get all SAlbums that contain the deleted image(s) (by using
SearchXmlReader) and buffer the ids of the images contained in those albums
(subtracting the deleted ones).

In the next step, I delete those SAlbums. I do that in order to have clean
SAlbums after rescanning for duplicates. Normally, if a duplicates search is
finished, all SAlbums for duplicates are deleted. But I want to delete only the
ones that were updated. And here comes the important spot. If an image is
deleted which reduces a SAlbum to size 1, this SAlbum is not created and
following this, the old SAlbum would not be deleted and would stay in the
duplicates view.

Since I have now all images that need to be rescanned, I can communicate those
images to the DuplicatesFinder. A new search is triggered and the updated
SAlbums are created.

My solution works for every variant for deleting images (context menu, main
menu and delete button). Also, the duplicates search does not need to be in
focus. If it is not, the duplicates search runs in background.

Now back to the part on getting notified about the deleted image. After
crawling through the code, I found out, that all deletion methods use the
imageViewUtilities. There, I have the information which images are deleted.
Thus I send a signal to the AlbumManager to check whether some SAlbums become
invalid. Also, I wire the AlbumManager with a signal to the FindDuplicatesView
that triggers the DuplicatesSearch on the set of images.

Is this a more fitting way to solve that?


You are receiving this mail because:
You are the assignee for the bug.

More information about the Digikam-devel mailing list