Qt sets a QCocoaMenuDelegate on every menu it creates in order to emit
the (OSX specific) aboutToShow signal. However, there are a few cases
where OSX will copy a menu without copying the delegate. One of those
cases is the dock: the result of -[NSApplication applicationDockMenu:]
is used to create a new menu, to which a few more items are copied.
This copy is then send back to the dock.
This patch invokes the delegate's -menuWillOpen: method when
-[NSApplication applicationDockMenu:] is called. Note that sub-menus
won't receive the call-back, because the dock doesn't tell the
application what happens after returning from applicationDockMenu:.
Task-number: QTBUG-39604
Change-Id: I0e06df371a3d77342ae4b7148041214e5c4579d7
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>