Bug 293651 - The "Empty Trash" action is disabled when files have been moved to the trash by a non-KDE application
Summary: The "Empty Trash" action is disabled when files have been moved to the trash ...
Alias: None
Product: dolphin
Classification: Applications
Component: panels: places (show other bugs)
Version: 2.0
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: Peter Penz
Keywords: investigated, reproducible
Depends on:
Reported: 2012-02-08 16:22 UTC by Alex
Modified: 2012-05-21 21:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0


Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2012-02-08 16:22:00 UTC
Version:           2.0 (using KDE 4.8.0) 
OS:                Linux

Zim deletes its notes to recycle bin. But I can't clear recycle bin in dolphin from Zim's files.

Reproducible: Always

Steps to Reproduce:
Start Zim 0.54. Create a new note and add some text there. Then right click on the note in the list of all notes (left side of Zim window). Select to delete this note. It's gone to recycle bin. Now start Dolphin and right click on the recycle bin.

Actual Results:  
The "clear recycle bin" function is not available. But the recycle bin has the file, the icon shows that.

Expected Results:  
The "clear recycle bin" function should be available.

It doesn't happen with other files, deleted with dolphin. To me it was only Zim v0.54.

And if I add some files to recycle bin and clear it - all files are gone along with Zim's deleted note.
Comment 1 Frank Reininghaus 2012-05-21 20:49:24 UTC
Thanks for the bug report! I can reproduce this with Zim 0.56 and KDE 4.8.3.

The problem is that KFilePlacesView (which provides the contents of the Places Panel in KDE <= 4.8.x) reads KDE's "trashrc" file and checks if it contains the line "Empty=true" to decide if the action should be enabled. This file does not get updated when using a non-KDE application to move items to the trash, which is why this bug occurs.

@Peter: I've noticed that in 4.9, PlacesItem uses a dir lister to determine if the trash is empty and then updates the icon. Maybe we should use the same approach to enable/disable the action in the context menu.

One could copy&paste the code from PlacesItem to PlacesPanel, but that's a bit ugly because of code duplication. Maybe a better approach is to move the code to PlacesItemModel and notify both the "trash"-PlacesItem and the PlacesPanel via signals about the state of the trash. Do you agree, Peter? If yes, I could try to come up with a patch.
Comment 2 Peter Penz 2012-05-21 21:02:48 UTC
Thanks Frank, but I'd suggest to instead of moving the KDirLister stuff to KFilePlacesModel to just let the PlacesPanel check the icon of the trash-item before opening the menu.
Comment 3 Frank Reininghaus 2012-05-21 21:21:06 UTC
Git commit 0aa9628b381befba92bc6a8cfccd6d35cfdee094 by Frank Reininghaus.
Committed on 21/05/2012 at 23:15.
Pushed by freininghaus into branch 'master'.

Enable the "Empty Trash" action if items are deleted by non-KDE apps

To achieve this, the Places Panel context menu now checks the icon of
the "Trash" item (which is updated by a dir lister that watches the
state of the trash), rather then reading a config file which is only
used by KDE applications.
FIXED-IN: 4.9.0

M  +1    -3    dolphin/src/panels/places/placespanel.cpp

Comment 4 Frank Reininghaus 2012-05-21 21:22:15 UTC
Thanks for the hint Peter, that was indeed much easier :-)