Bug 476397

Summary: Trash status not update if you use the context menu to delete
Product: [Applications] digikam Reporter: Peter <benedekppeter>
Component: Albums-TrashAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 8.2.0   
Target Milestone: ---   
Platform: Mint (Debian based)   
OS: Linux   
Latest Commit: Version Fixed In: 8.3.0
Sentry Crash Report:
Attachments: Deletion status of trash is not updated

Description Peter 2023-11-01 08:21:18 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
Trash status not update in the left sidebar if you use the context menu to delete.

STEPS TO REPRODUCE
1. Click right click on the trash icon in the left sidebar. 
2. Chose delete items

OBSERVED RESULT
digiKam performs the delete operation, but the icon still shows the number of items waiting to be deleted.
video attached.

EXPECTED RESULT
At the end of the operation, digiKam should show the real status of the trash.

SOFTWARE/OS VERSIONS
Windows: 10
Linux/KDE Plasma: Linux Mint 21.2 (digikam 8.2.0 appimage)
Comment 1 Peter 2023-11-01 08:23:34 UTC
Created attachment 162785 [details]
Deletion status of trash is not updated
Comment 2 Maik Qualmann 2023-11-01 11:41:59 UTC
I can't reproduce the issue here with my current developer version and AppImage.

Maik
Comment 3 Peter 2023-11-01 11:49:00 UTC
Tested in: digiKam-8.2.0-20231029T182058-x86-64.appimage

The error only occurs when deleting more than one image in the trash.
Comment 4 Peter 2023-11-01 12:16:02 UTC
If digiKam's main window loses and then regains focus, the trash icon is also updated and correctly shows the empty state.
If you resize digiKam's main window, the correct status (empty) will be displayed.
If you click on the empty area after deletion in the middle of the digiKam window, the trash can icon will refresh and show the empty value.

After deleting multiple items, the trash can icon does not refresh, you have to click somewhere.
Comment 5 Maik Qualmann 2023-12-21 07:28:25 UTC
Git commit 237e43dcc22957dc8cf5189af4ea58232d358819 by Maik Qualmann.
Committed on 21/12/2023 at 08:27.
Pushed by mqualmann into branch 'master'.

update trash counters after changing trash contents
Related: bug 478722
FIXED-IN: 8.3.0

M  +0    -4    core/libs/album/engine/album.cpp
M  +0    -4    core/libs/album/treeview/albumtreeview.cpp
M  +0    -1    core/libs/iojobs/iojob.cpp
M  +19   -0    core/libs/models/albummodel.cpp
M  +4    -0    core/libs/models/albummodel.h

https://invent.kde.org/graphics/digikam/-/commit/237e43dcc22957dc8cf5189af4ea58232d358819