Fix reconnection logic in the client

Seems like b654b2f broke reconnecting the client to the core; it would
only try once and then stop trying. Thanks to mamarley for noticing that bug
and bisecting the culprit.

The main issue causing this was that CoreConnection called
resetConnection(false) before (re)connecting, thus clearing the reconnect
flag. This call is a remnant from before we refactored out all the socket
handling and should not be needed anymore, now that we have clean disconnected()
semantics. Before b654b2f this was not a problem, because we would always
receive a socket error on failed reconnect that would reinstate the flag.

Because b654b2f worked around another issue by always sending a disconnected()
when the socket goes back into UnconnectedState, and this would happen before
the socket error signal was sent, the error handling would never be called
and the reconnect flag thus not reinstated, causing this bug.

So the second fix is to spin the event loop such that the error signal can
overtake that disconnected() signal and be handled properly (so we also
get the socket error message in the status bar).