Disable the "Create Folder..." action (triggered by F10) in read-only directories
Review Request #114560 - Created Dec. 20, 2013 and submitted
Pressing F10 in a read-only directory and then clicking "OK" in the "Create new folder" dialog will trigger an error message because it is not possible to create a new folder. To fix this, one can keep a pointer to the action in DolphinViewActionHandler, connect that class to the view's writeStateChanged(bool) signal, and update the action when this signal is received.
Fixes the problem for me.
Review request changed
(a) Simplified the patch by using the action collection to retrieve the "create_dir" action. (b) Disabled the action by default. I noticed that this is necessary to ensure that F10 is disabled when opening Dolphin in a read-only folder (e.g., with "dolphin /"). The DolphinView only emits its signal when the "writable" state changes, and the action collection misses the very first change from "true" to "false" in DolphinView::slotDirectoryLoadingStarted() because the first signal is emitted before the action collection is connected to the signal). With the first version of the patch, F10 would only be disabled if first a writable folder was visited, and then a non-writable one.
Revision 2 (+13)