Opened 6 years ago

Closed 2 years ago

#9205 closed Patch (outdated)

Context menu opens on unexpected item in LocalTreeView/RemoteTreeView (where you can accidentally delete wrong directory)

Reported by: er11 Owned by:
Priority: normal Component: FileZilla Client
Keywords: Cc:
Component version: Operating system type: Windows
Operating system version: 7 Home Premium SP1

Description (last modified by Tim Kosse)

I am using Windows 7 and haven't tested this under other operating systems. This happened to me with stable release 3.7.3 and a build I did tonight from SVN.

When using the right mouse button to bring up the context menu in either the local or remote directory tree controls in FileZilla Client, if you drag from the highlighted folder over one that isn't highlighted and release the button, the non-highlighted folder will be the target of the context menu that pops up. Worse, if this happens with a remote directory and you choose to delete the directory, the warning dialog that comes up doesn't give the name of the directory to be deleted.

I took a look at src/interface/LocalTreeView.* and src/interface/RemoteTreeView.* as well as the wxTreeCtrl source from wxWidgets 2.8.12. The event handler for a context menu event in LocalTreeView/RemoteTreeView is passed a tree item ID by wxWidgets that corresponds to the current mouse cursor position when the right mouse button is released. This is apparently standard behavior for Windows, so it seems it's up to FileZilla to accommodate it.

I'm attaching a patch that solves the issue for me. It adds an event handler for right-button drag that sets a boolean variable to 'true' to indicate (when the button is released and OnContextMenu() is called) that the context menu should use the currently selected tree item instead of the one passed to it by wxWidgets. If no drag occurs, the variable is false and the context menu will use the tree item passed by wxWidgets. The variable is reset to false after each OnContextMenu() call.

I thought it might be sufficient to have OnContextMenu() always use the selected item instead of the one under the mouse pointer, but if that is done it does not find the correct item if a different folder than the one currently selected is right-clicked.

Attachments (1)

tree.patch (4.4 KB) - added by er11 6 years ago.
Patch

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by er11

Attachment: tree.patch added

Patch

comment:1 Changed 4 years ago by Tim Kosse

Description: modified (diff)
Status: newmoreinfo

Unfortunately the patch does not work. Right-click drag a remote file to the local file list for example.

Can you fix it please?

comment:2 Changed 2 years ago by Kurt McKee

Resolution: outdated
Status: moreinfoclosed
Note: See TracTickets for help on using tickets.