Bug 259356

Summary: Folder View pointed at Trash doesn't update the context menu properly
Product: [Plasma] plasma4 Reporter: Marcus Harrison <marcus>
Component: widget-folderviewAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: dave.greengas, thomasdn
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot showing reproduction of the bug

Description Marcus Harrison 2010-12-09 18:16:39 UTC
Version:           unspecified (using KDE 4.5.3) 
OS:                Linux

A Folder View in the panel that is pointed to trash:/ shows the correct icon for when the wastebin is empty or has files in it. I created it by dragging it from dolphin's Places sidebar to the panel and creating a Folder View from the context menu. However, the right-click context menu entry, "Empty Wastebin" remains in the state that it was in when the widget was created, even when the state of trash:/ has changed: if the widget was created when the wastebin was empty, and you then send something to the wastebin, the context menu entry to empty the wastebin remains disabled.

Reproducible: Always




OS: Linux (i686) release 2.6.35-24-generic
Compiler: cc
Comment 1 David Greengas 2010-12-09 20:05:52 UTC
Created attachment 54366 [details]
Screenshot showing reproduction of the bug

I can confirm that following the steps to reproduce the bug in KDE 4.5.4. Please see attached screenshot. My steps were as follows:
1) Drag empty Trash to Panel from within Dolphin and create folder view
2) Add something to the trash observing that the icon on the panel changes as desired
3) Right-click on the trash icon in the panel and see that emptying the trash is not possible
Comment 2 David Greengas 2010-12-09 23:28:12 UTC
I was just browsing through websvn.kde.org to see if I could quickly find why this could be occurring. This may be completely wrong, but it could at least be a start. In kdebase/apps/plasma/applets/folderview/folderview.cpp, I noticed that the method FolderView::contextualActions checks to see if the url protocol is trash before adding the empty_trash action, but does not check to see if it should be enabled or not. The latter is checked only once in createActions.
if (m_url.protocol() == "trash") {    actions.append(m_actionCollection.action("empty_trash"));
}

Perhaps adding this inside the if would help
KConfig trashConfig("trashrc", KConfig::SimpleConfig);
m_actionCollection.action("empty_trash")->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));

just before appending it to the context menu.
Comment 3 Gregor Tätzner 2011-12-03 13:49:18 UTC
*** Bug 273079 has been marked as a duplicate of this bug. ***
Comment 4 Gregor Tätzner 2011-12-03 17:49:28 UTC
Git commit fed2ad991153672deecfc2df7c51bb34a58761c5 by Gregor Tätzner.
Committed on 03/12/2011 at 18:33.
Pushed by gregort into branch 'master'.

Folder View pointed at Trash doesn't update the context menu properly

enable empty_trash action in contextualActions when the url is pointing
to trash:/. contextualActions checks to see if the url protocol is trash
before adding the empty_trash action, but does not check to see if it
should be enabled or not.

BUG: 259356
REVIEW: 103282

M  +3    -0    plasma/applets/folderview/folderview.cpp

http://commits.kde.org/kde-baseapps/fed2ad991153672deecfc2df7c51bb34a58761c5