From e503dedbf6d73dc22a7ed32a78806075da589ae7 Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Mon, 8 Dec 2025 09:50:53 +0200 Subject: Clean up service plugin signal connections - minor API changes The states and signals were painful to follow due to bad naming and excessive overloading. Here: - Renamed some API to avoid overloading, help readability and allow new connect() syntax without resolving the overloads. - updateStatus() signals and slots renamed a bit to make it clearer what is a signal and what is a slot. And avoiding overloading QMailMessageService::updateStatus() to simplify signal connection. - Cleaned up QMailTranport API. It's not doing urls but hostnames and the signals were especially hard to follow - Use the new connect() syntax in messageserver side - Avoiding some protected: / virtual methods when there's nothing even able to inherit the class. - At least print SSL errors instead of signal that's not connected anywhere. - Some minor simplifications and code style adjustments. The SSL error handling is still funny but at least a bit easier to track. Change-Id: If168e15ef068fedee46b9401d695ed5dae7962ba Reviewed-by: Reviewed-by: Damien Caliste Reviewed-by: Pekka Vuorela --- tests/tst_imap/tst_imap.cpp | 2 +- tests/tst_pop/tst_pop.cpp | 10 +++++----- tests/tst_smtp/tst_smtp.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/tst_imap/tst_imap.cpp b/tests/tst_imap/tst_imap.cpp index 04855e86..36f55f32 100644 --- a/tests/tst_imap/tst_imap.cpp +++ b/tests/tst_imap/tst_imap.cpp @@ -112,7 +112,7 @@ void tst_ImapClient::test_connection() { ConnectionStrategy strategy; QSignalSpy completed(mClient, &ImapClient::retrievalCompleted); - QSignalSpy updateStatus(mClient, &ImapClient::updateStatus); + QSignalSpy updateStatus(mClient, &ImapClient::statusChanged); mClient->setStrategy(&strategy); mClient->newConnection(); diff --git a/tests/tst_pop/tst_pop.cpp b/tests/tst_pop/tst_pop.cpp index 9d24e119..7e6a0ee3 100644 --- a/tests/tst_pop/tst_pop.cpp +++ b/tests/tst_pop/tst_pop.cpp @@ -56,10 +56,6 @@ private: PopClient *mClient = nullptr; }; -QTEST_MAIN(tst_PopClient) - -#include "tst_pop.moc" - void tst_PopClient::initTestCase() { QMailAccount account; @@ -94,7 +90,7 @@ void tst_PopClient::cleanupTestCase() void tst_PopClient::test_connection() { QSignalSpy completed(mClient, &PopClient::retrievalCompleted); - QSignalSpy updateStatus(mClient, &PopClient::updateStatus); + QSignalSpy updateStatus(mClient, &PopClient::statusChanged); mClient->testConnection(); QVERIFY(!completed.wait(250)); // Fails with wrong credentials @@ -105,3 +101,7 @@ void tst_PopClient::test_connection() QCOMPARE(updateStatus.takeFirst().first().toString(), QString::fromLatin1("Connected")); QCOMPARE(updateStatus.takeFirst().first().toString(), QString::fromLatin1("Logging in")); } + +QTEST_MAIN(tst_PopClient) + +#include "tst_pop.moc" diff --git a/tests/tst_smtp/tst_smtp.cpp b/tests/tst_smtp/tst_smtp.cpp index 99d534af..5784e7c0 100644 --- a/tests/tst_smtp/tst_smtp.cpp +++ b/tests/tst_smtp/tst_smtp.cpp @@ -88,7 +88,7 @@ void tst_SmtpClient::cleanupTestCase() void tst_SmtpClient::test_connection() { QSignalSpy completed(mClient, &SmtpClient::sendCompleted); - QSignalSpy updateStatus(mClient, &SmtpClient::updateStatus); + QSignalSpy updateStatus(mClient, &SmtpClient::statusChanged); mClient->newConnection(); QVERIFY(completed.wait()); @@ -102,7 +102,7 @@ void tst_SmtpClient::test_connection() void tst_SmtpClient::test_auth() { QSignalSpy completed(mClient, &SmtpClient::sendCompleted); - QSignalSpy updateStatus(mClient, &SmtpClient::updateStatus); + QSignalSpy updateStatus(mClient, &SmtpClient::statusChanged); QMailAccountConfiguration config(mClient->account()); SmtpConfigurationEditor smtp(&config); -- cgit v1.2.3