Bug 259356 - Folder View pointed at Trash doesn't update the context menu properly
Summary: Folder View pointed at Trash doesn't update the context menu properly
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Unmaintained
Component: widget-folderview (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR minor
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 273079 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-09 18:16 UTC by Marcus Harrison
Modified: 2011-12-03 17:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot showing reproduction of the bug (79.76 KB, image/png)
2010-12-09 20:05 UTC, David Greengas
Details

Note You need to log in before you can comment on or make changes to this 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