Index: autotests/testsession.cpp =================================================================== --- autotests/testsession.cpp +++ autotests/testsession.cpp @@ -76,7 +76,6 @@ QTest::qWait(500); QCOMPARE((int)s.state(), (int)KIMAP::Session::Disconnected); QCOMPARE(spyFail.count(), 1); - QEXPECT_FAIL("", "FIXME KDE5: Don't emit connectionLost() on a failed connection", Continue); QCOMPARE(spyLost.count(), 0); QCOMPARE(spyState.count(), 0); @@ -115,8 +114,8 @@ // connectionFailed() signal should have been emitted. QTest::qWait(500); QCOMPARE((int)s.state(), (int)KIMAP::Session::Disconnected); - QCOMPARE(spyFail.count(), 1); - QCOMPARE(spyLost.count(), 0); + QCOMPARE(spyFail.count(), 0); + QCOMPARE(spyLost.count(), 1); QCOMPARE(spyState.count(), 0); } Index: src/session.h =================================================================== --- src/session.h +++ src/session.h @@ -99,18 +99,11 @@ void jobQueueSizeChanged(int queueSize); /** - @deprecated - Emitted when we loose a previously established connection + Emitted when we lose a previously established connection Likely reasons: server closed the connection, loss of internet connectivity, etc... - - For historical reasons, this signal is also emitted in the event of a failed connection, but - you should not rely on this behavior. - - New implementations should use connectionFailed() to detect a failure to connect to the host, - and stateChanged() to detect a loss of connectivity. */ - KIMAP_DEPRECATED void connectionLost(); + void connectionLost(); /** Emitted when the Session couldn't connect to the host. @@ -128,8 +121,7 @@ /** Emitted when the session's state changes. - You can use this signal to detect a connection loss (ie: stateChanged is emitted with newState - == KIMAP::Session::Disconnected) + Not very useful after all... :-) If you want to receive the stateChanged arguments in your slot, you must register the State enum with @c Q_DECLARE_METATYPE(KIMAP::Session::State) and @c qRegisterMetaType(); Index: src/session.cpp =================================================================== --- src/session.cpp +++ src/session.cpp @@ -393,7 +393,7 @@ logger->disconnectionOccured(); } - if (state != Session::Disconnected) { + if (isSocketConnected) { setState(Session::Disconnected); emit q->connectionLost(); } else { @@ -427,7 +427,6 @@ thread->closeSocket(); } else { emit q->connectionFailed(); - emit q->connectionLost(); // KDE5: Remove this. We shouldn't emit connectionLost() if we weren't connected in the first place clearJobQueue(); } }