Bug 506314 - Dragging an attachment also opens the "Open Attachment" dialogue
Summary: Dragging an attachment also opens the "Open Attachment" dialogue
Status: ASSIGNED
Alias: None
Product: kmail2
Classification: Applications
Component: UI (other bugs)
Version First Reported In: Git (master)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-28 14:15 UTC by Jonathan Marten
Modified: 2025-10-06 14:07 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2025-06-28 14:15:00 UTC
SUMMARY
If an attachment is dragged from the message header to anywhere (e.g. a Dolphin window), then when the mouse button is released the "Move/Copy/Link here" menu pops up correctly but the "Open Attachment?" dialogue also opens.  This happens even if the drag is to somewhere that does not accept it.

STEPS TO REPRODUCE
1.  View an email with attachments, either in the preview pane or a separate viewer window.
2.  Drag one of the attachments with the left mouse button to a Dolphin window.  Observe the the "Move/Copy/Link Here" menu pops up and the "Open Attachment?" dialogue also opens.
3.  Click "Cancel" on both the popup and dialogue.
4.  Do the same again, but release the drag over somewhere that does not accept it - for example, onto the KMail menu bar or toolbar.  Observer that nothing is dragged but the dialogue again opens.

OBSERVED RESULT
The "Open Attachment?" dialogue opens when a drag is finished, regardless of whether the drag is accepted or not.

EXPECTED RESULT
The "Open Attachment?" dialogue should only open when an attachment is single clicked, not when it is dragged.

SOFTWARE/OS VERSIONS
Operating System: Gentoo 2.17
KDE Plasma Version: 6.4.80
KDE Frameworks Version: 6.15.0
Qt Version: 6.8.3
Kernel Version: 6.6.47-gentoo-x86_64 (64-bit)
Graphics Platform: X11
Processors: 3 × AMD Phenom(tm) II X3 705e Processor
Memory: 16 GiB of RAM (15.6 GiB usable)

ADDITIONAL INFORMATION
messagelib: Git 8f75b946
kmail: Git e46a6a66
Comment 1 Laurent Montel 2025-06-28 15:41:40 UTC
I confirm it
Comment 2 Jonathan Marten 2025-10-06 14:07:53 UTC
The problem is that MailWebEngineView::forwardMousePressEvent() checks that a drag could potentially be started, but does not accept the event.  So the click is also seen and the attachment URL opened by WebEnginePage::acceptNavigationRequest().  The solution may be to accept the mouse press event, and then if a mouse release event happens without a drag having been started then and only then action the URL click.