lolo101/MsgViewer

feature request - right click to download attachments

Opened this issue · 3 comments

How about right click on attachments and choose where to download them instead of open them directly?

Hi @kintaro1981 !
Yeah that would be neat!
I'll sure think about it but I can't guarantee to prioritize this feature since I already have another task about global configuration file and a bug to fix

Hello, any news about this?

Hi @kintaro1981

I could not find a solution for this feature request at the moment.
The difficulty is that the component used to display the header and the attachments is a JEditorPane, and it only responds to left-click on hyperlinks.

See handling code in HTMLEditorKit:

        public void mouseClicked(MouseEvent e) {
            JEditorPane editor = (JEditorPane) e.getSource();

            if (! editor.isEditable() && editor.isEnabled() &&
                    SwingUtilities.isLeftMouseButton(e)) {
                Point pt = new Point(e.getX(), e.getY());
                int pos = editor.viewToModel(pt);
                if (pos >= 0) {
                    activateLink(pos, editor, e);
                }
            }
        }

An alternative is to add a MouseListener to the component, find which hyperlink was clicked, and open a dialog to save the file (actually, the file is already in a temporary folder on the filesystem)