From 202e726df436193d918d63530641fac618537cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 8 Aug 2025 14:43:17 +0200 Subject: [PATCH] mailnotification: Add Qt6 support --- .../integrationpluginmailnotification.cpp | 6 +++--- .../integrationpluginmailnotification.h | 7 ++++--- mailnotification/mailnotification.pro | 4 +--- mailnotification/smtpclient.cpp | 14 +++++++++----- mailnotification/smtpclient.h | 5 +---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mailnotification/integrationpluginmailnotification.cpp b/mailnotification/integrationpluginmailnotification.cpp index c96875f5..c33ac2a7 100644 --- a/mailnotification/integrationpluginmailnotification.cpp +++ b/mailnotification/integrationpluginmailnotification.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -29,10 +29,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "integrationpluginmailnotification.h" - -#include "integrations/thing.h" #include "plugininfo.h" +#include + #include #include #include diff --git a/mailnotification/integrationpluginmailnotification.h b/mailnotification/integrationpluginmailnotification.h index 0ebefaeb..8eb7148d 100644 --- a/mailnotification/integrationpluginmailnotification.h +++ b/mailnotification/integrationpluginmailnotification.h @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -31,7 +31,8 @@ #ifndef INTEGRATIONPLUGINMAILNOTIFICATION_H #define INTEGRATIONPLUGINMAILNOTIFICATION_H -#include "integrations/integrationplugin.h" +#include + #include "smtpclient.h" class IntegrationPluginMailNotification : public IntegrationPlugin @@ -52,7 +53,7 @@ public: void thingRemoved(Thing *thing) override; private: - QHash m_clients; + QHash m_clients; }; diff --git a/mailnotification/mailnotification.pro b/mailnotification/mailnotification.pro index ca65461d..47f5d4bd 100644 --- a/mailnotification/mailnotification.pro +++ b/mailnotification/mailnotification.pro @@ -1,8 +1,6 @@ include(../plugins.pri) -TARGET = $$qtLibraryTarget(nymea_integrationpluginmailnotification) - -QT+= network +QT *= network SOURCES += \ integrationpluginmailnotification.cpp \ diff --git a/mailnotification/smtpclient.cpp b/mailnotification/smtpclient.cpp index dcb9beb9..cac5b5a5 100644 --- a/mailnotification/smtpclient.cpp +++ b/mailnotification/smtpclient.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -42,7 +42,11 @@ SmtpClient::SmtpClient(QObject *parent): connect(m_socket, &QSslSocket::readyRead, this, &SmtpClient::readData); connect(m_socket, &QSslSocket::disconnected, this, &SmtpClient::disconnected); connect(m_socket, &QSslSocket::encrypted, this, &SmtpClient::onEncrypted); +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) + connect(m_socket, &QTcpSocket::errorOccurred, this, &SmtpClient::onSocketError); +#else connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onSocketError(QAbstractSocket::SocketError))); +#endif } void SmtpClient::connectToHost() @@ -247,9 +251,9 @@ void SmtpClient::processServerResponse(int responseCode, const QString &response if (m_authenticationMethod == AuthenticationMethodPlain) { send("AUTH PLAIN " + QByteArray().append(static_cast(0)) - .append(m_user) + .append(m_user.toUtf8()) .append(static_cast(0)) - .append(m_password) + .append(m_password.toUtf8()) .toBase64()); // If we just want to test the Login, we are almost done here @@ -266,7 +270,7 @@ void SmtpClient::processServerResponse(int responseCode, const QString &response break; case StateUser: if (responseCode == 334) { - send(QByteArray().append(m_user).toBase64()); + send(QByteArray().append(m_user.toUtf8()).toBase64()); setState(StatePassword); } else { handleUnexpectedSmtpCode(responseCode, response); @@ -274,7 +278,7 @@ void SmtpClient::processServerResponse(int responseCode, const QString &response break; case StatePassword: if (responseCode == 334) { - send(QByteArray().append(m_password).toBase64()); + send(QByteArray().append(m_password.toUtf8()).toBase64()); // if we just want to test the Login, we are almost done here if (!m_testLogin) { setState(StateMail); diff --git a/mailnotification/smtpclient.h b/mailnotification/smtpclient.h index 3f948bdd..80ca6eec 100644 --- a/mailnotification/smtpclient.h +++ b/mailnotification/smtpclient.h @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2025, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -39,8 +39,6 @@ #include #include -//#include "integrations/integrationplugin.h" - Q_DECLARE_LOGGING_CATEGORY(dcSmtpClient) struct Message { @@ -49,7 +47,6 @@ struct Message { int id; }; - class SmtpClient : public QObject { Q_OBJECT