Bug 252483

Summary: Trash icons in dolphin not properly updated after a "restore" operation
Product: [Applications] dolphin Reporter: Nicofo <nicofo>
Component: panels: placesAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: adaptee, annapareddyjanardhanreddy, bryan.cuneo, bugseforuns, claudius.ellsel, faure, frank78ac, nate, simonandric5, sudhir, zhaixiang
Priority: NOR    
Version: 16.12.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=163337
Latest Commit: Version Fixed In: 4.10.1
Sentry Crash Report:
Attachments: patch for konq_operations.cpp file in kde-baseapps/lib/konq

Description Nicofo 2010-09-26 23:06:12 UTC
Version:           unspecified (using KDE 4.5.1) 
OS:                Linux

After restoring all the files from the trash, the trash icons* remain 'full'

* trash icon in the address bar and in the side panel
The trash widget on the desktop behaves OK

Reproducible: Always

Steps to Reproduce:
0) The trash is empty
1) Delete a file
2) Go to the Trash view: there is one item, the trash icon shows a full trash
3) Restore the item
4) The trash is emptied, BUT the trash icon still shows a full trash

Rem: press 'F5' to update the view => the trash icons becomes emptied


Expected Results:  
The trash icon should show an emptied trash after a restore operation if the trash is actually emptied.
Comment 1 Frank Reininghaus 2010-09-26 23:32:43 UTC
Thanks for the bug report! I could confirm the issue in trunk.
Comment 2 Nicofo 2010-11-13 23:12:24 UTC
Still present in 4.5.2.

I can add this other bug (linked to the previous I guess):

0) there are files in the Trash => Go to the trash in dolphin: OK: the icon is "full trash"
1) delete the files *by selecting them then press the "delete" button*
2) as a result, the trash is emptied, but here again, the trash icon remains "full trash"
Comment 3 Nicofo 2011-03-07 19:59:24 UTC
Still present in 4.6.1.
Comment 4 Jekyll Wu 2011-07-09 13:23:29 UTC
have the same problem in 4.6.90

If that deleted file is recovered through Edit->Undo, then the trash icon will become empty as expected.
Comment 5 Nicofo 2011-11-07 19:38:33 UTC
Still present in 4.7.3.
Comment 6 A JANARDHAN REDDY 2011-12-05 14:03:01 UTC
Created attachment 66404 [details]
patch for konq_operations.cpp file in kde-baseapps/lib/konq

when we restore a file or delete a file from trash, we need to emit dataChanged() signal from our custom model so that corresponding view gets updated.

I tried filesremoved slot of kdirnotify but it was not working so i emitted filesadded instead of that which in turn emits datachanged ().[ because i don't have access to kdirnotify.cpp ]
Comment 7 Peter Penz 2011-12-05 14:18:33 UTC
Thanks for the patch! It looks fine from my point of view but I cannot decide whether it should get pushed: Would it be possible that you make an "official" merge-request by posting the patch to https://git.reviewboard.kde.org/dashboard/ and put David Faure (dfaure@kde.org) to the reviewers? The patched code is maintained by David and it is impossible for David to keep an overview about all the open issues/patches in bugs.kde.org... (but David keeps an eye on the patches from the reviewboard).
Comment 8 A JANARDHAN REDDY 2011-12-05 17:29:01 UTC
hi,
what is the login for review board. By the way can you tell why emitfilesremoved is not working.
(In reply to comment #7)
> Thanks for the patch! It looks fine from my point of view but I cannot decide
> whether it should get pushed: Would it be possible that you make an "official"
> merge-request by posting the patch to
> https://git.reviewboard.kde.org/dashboard/ and put David Faure (dfaure@kde.org)
> to the reviewers? The patched code is maintained by David and it is impossible
> for David to keep an overview about all the open issues/patches in
> bugs.kde.org... (but David keeps an eye on the patches from the reviewboard).
Comment 9 Peter Penz 2011-12-05 18:44:13 UTC
> what is the login for review board.

You need to request an account at https://identity.kde.org/

> By the way can you tell why emitfilesremoved is not working.

No sorry - I'm not familiar with the code of konq_operations...
Comment 10 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:19:53 UTC
Resetting assignee to default as per bug #305719
Comment 11 Bryan Cuneo 2012-10-27 17:12:47 UTC
[Part of the Dolphin Bug Weeks 2012]
I can confirm this on still exists in Dolphin 2.1/KDE SC 4.9.2 (openSUSE 12.2.6 KR49 packages). The icon also stays "full" when you delete an item from the trash without using the "Empty Trash" option.
Comment 12 Bryan Cuneo 2012-10-27 17:15:37 UTC
(In reply to comment #11)
> [Part of the Dolphin Bug Weeks 2012]
> I can confirm this on still exists in Dolphin 2.1/KDE SC 4.9.2 (openSUSE
> 12.2.6 KR49 packages). The icon also stays "full" when you delete an item
> from the trash without using the "Empty Trash" option.

Oops. Missed that this is apparently a libkonq issue.
Comment 13 Frank Reininghaus 2012-11-06 07:28:13 UTC
@David: could you have a look at the patch from comment 6?
Comment 14 BT 2013-02-17 23:09:01 UTC
I can confirm that this issue is still present in 4.10 .

Distribution: Gentoo
KDE: 4.10
Comment 15 David Faure 2013-02-19 10:16:06 UTC
Git commit bf7cdfca99e4d28d6f40d019b34f7fe5679c1715 by David Faure.
Committed on 19/02/2013 at 11:17.
Pushed by dfaure into branch 'KDE/4.10'.

Update views showing trash:/ when restoring trashed files.

Thanks to A.J.Reddy for the investigation and initial patch, and thanks
to Frank Reininghaus for the testing.
FIXED-IN: 4.10.1

M  +3    -3    lib/konq/konq_operations.cpp

http://commits.kde.org/kde-baseapps/bf7cdfca99e4d28d6f40d019b34f7fe5679c1715
Comment 16 Nicofo 2013-02-19 19:08:05 UTC
OK thanks. Does the correction also work when you delete files from trash (see comment #2) ?
Because in the patch (from comment #6) I see the test "|| m_method == DEL" which is not present in the lats commit ?
Comment 17 BT 2013-02-19 21:54:15 UTC
I can confirm that the commit from comment 15 fixes the issue when restoring but not when deleting.
Comment 18 Nicofo 2013-02-21 18:41:47 UTC
Reopen the bug since not completely solved.
=> see comment #2
Comment 19 Frank Reininghaus 2013-02-22 09:53:21 UTC
Thanks for testing. It's extremely easy to miss things like that, especially if there are comments in the report that add new, similar bugs to the existing one, but I hope that a clean solution for the remaining one can also be found. I guess the main question is if there is a better solution than updating the trash for every single 'delete' operation.
Comment 20 Christoph Feck 2016-07-18 19:25:17 UTC
*** Bug 365754 has been marked as a duplicate of this bug. ***
Comment 21 Nate Graham 2017-09-03 00:41:59 UTC
Confirmed that the Trash icon still doesn't update when you use a Delete operation to render it empty.
Comment 22 Nate Graham 2017-09-03 01:50:32 UTC
*** Bug 251620 has been marked as a duplicate of this bug. ***
Comment 23 Nate Graham 2017-09-03 17:01:39 UTC
*** Bug 356981 has been marked as a duplicate of this bug. ***
Comment 24 Roman Inflianskas 2018-03-01 16:40:58 UTC
*** Bug 366662 has been marked as a duplicate of this bug. ***
Comment 25 Roman Inflianskas 2018-03-11 16:47:42 UTC
Git commit c0797e8adef58bc57254d86d6f1abaa46d732f19 by Roman Inflianskas.
Committed on 11/03/2018 at 16:47.
Pushed by romaninflianskas into branch 'master'.

Update trash icon after restore operation

Summary:
After restoring all the files from the trash, the trash icon remain 'full'. This patch fixes this.

Reviewers: elvisangelaccio

Reviewed By: elvisangelaccio

Subscribers: elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D11216

M  +1    -0    src/trash/dolphintrash.cpp

https://commits.kde.org/dolphin/c0797e8adef58bc57254d86d6f1abaa46d732f19
Comment 26 Patrick Silva 2018-03-26 02:34:14 UTC
not completely fixed in Dolphin 18.04, Arch Linux.

open dolphin (if info panel is not enabled, press F11 to do it)
send some file to trash
click trash icon under places in sidebar (observe red trash icon in info panel)
click "empty trash" button
trash icon in info panel is still red
Comment 27 Nate Graham 2018-05-02 04:19:28 UTC
I can't reproduce your issue, Dr Chapatin. Those steps to reproduce work fine for me with 18.04.0 as well as current git master.
Comment 28 Patrick Silva 2018-05-02 12:21:57 UTC
(In reply to Nate Graham from comment #27)
> I can't reproduce your issue, Dr Chapatin. Those steps to reproduce work
> fine for me with 18.04.0 as well as current git master.

Weird. I opened bug 392882 about this issue.
On my neon dev unstable trash icon have other two bugs.