Rework handling of connection failures, to fix crashes.
Testcase: unplugging my network cable, waiting for timeouts, plugging it back again later, check mail. * Port from deprecated connectionLost to stateChanged, which has the major benefit of not confusing "failure to connect" with "we lost our connection" (due to KIMAP::Session emitting both signals for compat reasons). * Failure to connect is now handled in the result slot for the LoginJob, rather than via the connectionFailed signal, since the first one is called anyway. * Make sure we emit connectDone on error, even if m_initialConnectDone is true, so that the resource sets itself to offline (rather than it attempting the same task over and over again!). * Don't set the resource status to Broken when it's simply offline (login failure due to "could not connect" is handled separately now) * Make sure not to pop up a password dialog when couldn't connect; this is different from "we could connect but the server refused login". Requires kdepimlibs commit acdb0f7e50 for ERR_COULD_NOT_CONNECT. FIXED-IN: 4.8 BUG: 288268 (cherry picked from commit 757f464e)