Revert "Cocoa: Post event to "show()" a modal window"

This reverts commit a9cbddf4739f3cfabd38367b5f872fe2c1a3814c.

The reverted commit is an incorrect bug-fix for a
regression introduced by adding a call to
[NSApp abortModal] in change d9875f7b.

Change-Id: If23463ebdfe2ff64c68739dbece73a13773683c9
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Revert "Cocoa: Don't stop NSApp when showing a modal dialog"

This reverts commit ff3dcc49c4a1912189091e35e87cb61af2f62d47.

The reverted commit is an incorrect bug-fix for a
regression introduced by adding a call to
[NSApp abortModal] in change d9875f7b.

Change-Id: I1307d1790ada740e0552d62267b6009cbccd6c4c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Partially revert "Cocoa: support modal windows"

This reverts parts of commit d9875f7bff6d52a52a1d0bf4002044a5304cf6bf,
in particular the code for "2. Make interrupt() use [NSApp abortModal]"

abortModal is not the right way to end a modal session,
and introduced bad side effects, as reported in
QTBUG-34677.

Restore this part of the event dispatcher to the
Qt 4 state.

Change-Id: Iacc2d4a0757807c87c4320c93ed4db186622945c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Cocoa: Fix modal session cleanup.

Call [NSApp endModalSession] at the correct time.

Calling cleanupModalSessions() from processPostedEvents()
resulted in endModalSession being called from within
[NSApp runModalSession] - ending and cleaning up the
the modal session while Cocoa is still using it.

Move the cleanupModalSessions() call to to after
runModalSession returns.

Task-number: QTBUG-37699
Change-Id: I5868def36f6869667b0bbe33733286e3e49488eb
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>