summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Vuorela <pvuorela@iki.fi>2025-11-21 10:26:26 +0200
committerPekka Vuorela <pvuorela@iki.fi>2025-11-26 11:33:16 +0200
commitd532a1b2b068ac4a7e5ccac764585daee366b8fc (patch)
tree0dccd7311a8dcd28d961b613bedec9e62148d42f
parentd433b8398abd210e1f3b9afc53ede28932cf6a45 (diff)
Repurpose .pro files for qt5 support - almost works
There's still need for having qt5 support out there and the .pro files don't anyway compile with qt6 by now. Adjusting those and the code to build on qt5 didn't even require much adjustments. The hack to get _p.h includes work without private prefix, that used to be there for qmake build, is horrible but at least it's relatively small and affecting only .pro files. The examples had some existing issues building there, missing includes and not entirely disabled protocol editor support. The "almost works" part: builds fine but the metatype side is slightly lacking, resulting also a unit test failure. On qt5 qmailipc.h would need qRegisterMetaTypeStreamOperators() call after qRegisterMetaType() but I'm not eager to add qt version ifdeffing inside a macro, at least now. Hoping to clean up the whole metatype registration first. Change-Id: I6e620175383690ce4e6eb4c841e314ccf031026f Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
-rw-r--r--examples/messagingaccounts/messagingaccounts.pro4
-rw-r--r--examples/qtmail/attachmentlistwidget.cpp2
-rw-r--r--examples/qtmail/detailspage.cpp1
-rw-r--r--examples/qtmail/emailclient.cpp2
-rw-r--r--src/libraries/qmfclient/qmailstoresql_p.cpp9
-rw-r--r--src/libraries/qmfclient/qmfclient.pro2
-rw-r--r--src/libraries/qmfmessageserver/qmailtransport.cpp8
-rw-r--r--src/plugins/messageservices/imap/imap.pro2
-rw-r--r--src/plugins/messageservices/pop/pop.pro3
-rw-r--r--src/tools/messageserver/messageserver.pro3
-rw-r--r--tests/tests.pri4
11 files changed, 36 insertions, 4 deletions
diff --git a/examples/messagingaccounts/messagingaccounts.pro b/examples/messagingaccounts/messagingaccounts.pro
index 5ff2b74b..179516f4 100644
--- a/examples/messagingaccounts/messagingaccounts.pro
+++ b/examples/messagingaccounts/messagingaccounts.pro
@@ -9,11 +9,11 @@ INCLUDEPATH += \
$$QTMAIL_EXAMPLE
HEADERS += $$QTMAIL_EXAMPLE/accountsettings.h \
- $$QTMAIL_EXAMPLE/editaccount.h \
+ #$$QTMAIL_EXAMPLE/editaccount.h \
$$QTMAIL_EXAMPLE/statusbar.h
SOURCES += $$QTMAIL_EXAMPLE/accountsettings.cpp \
- $$QTMAIL_EXAMPLE/editaccount.cpp \
+ #$$QTMAIL_EXAMPLE/editaccount.cpp \
$$QTMAIL_EXAMPLE/statusbar.cpp \
main_messagingaccounts.cpp
diff --git a/examples/qtmail/attachmentlistwidget.cpp b/examples/qtmail/attachmentlistwidget.cpp
index f7a6ac79..9566f8db 100644
--- a/examples/qtmail/attachmentlistwidget.cpp
+++ b/examples/qtmail/attachmentlistwidget.cpp
@@ -461,7 +461,7 @@ void AttachmentListWidget::addAttachments(const QStringList& attachments)
m_model->setAttachments(m_attachments);
setVisible(!m_model->isEmpty());
- emit attachmentsAdded(newAttachments.toList());
+ emit attachmentsAdded(newAttachments);
}
}
diff --git a/examples/qtmail/detailspage.cpp b/examples/qtmail/detailspage.cpp
index 4333c8d2..8b5aa190 100644
--- a/examples/qtmail/detailspage.cpp
+++ b/examples/qtmail/detailspage.cpp
@@ -49,6 +49,7 @@
#include <qmailaccount.h>
#include <QApplication>
#include <QGuiApplication>
+#include <QScreen>
static const QString placeholder("(no subject)");
diff --git a/examples/qtmail/emailclient.cpp b/examples/qtmail/emailclient.cpp
index 8307c1c6..a0ca80a9 100644
--- a/examples/qtmail/emailclient.cpp
+++ b/examples/qtmail/emailclient.cpp
@@ -68,6 +68,8 @@
#include <QToolBar>
#include <QMovie>
#include <QStatusBar>
+#include <QScreen>
+
#include "statusmonitorwidget.h"
#include "statusbar.h"
#include "statusmonitor.h"
diff --git a/src/libraries/qmfclient/qmailstoresql_p.cpp b/src/libraries/qmfclient/qmailstoresql_p.cpp
index 8e79d0e1..57c35af7 100644
--- a/src/libraries/qmfclient/qmailstoresql_p.cpp
+++ b/src/libraries/qmfclient/qmailstoresql_p.cpp
@@ -3028,8 +3028,13 @@ static QString queryText(const QString &query, const QList<QVariant> &values)
int index = result.indexOf(marker);
while ((index != -1) && (it != end)) {
QString substitute((*it).toString());
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ if ((*it).type() == QVariant::String)
+ substitute.prepend(quote).append(quote);
+#else
if ((*it).metaType() == QMetaType::fromType<QString>())
substitute.prepend(quote).append(quote);
+#endif
result.replace(index, 1, substitute);
@@ -3043,7 +3048,11 @@ static QString queryText(const QString &query, const QList<QVariant> &values)
static QString queryText(const QSqlQuery &query)
{
// Note: we currently only handle positional parameters
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ return queryText(query.lastQuery().simplified(), query.boundValues().values());
+#else
return queryText(query.lastQuery().simplified(), query.boundValues());
+#endif
}
QSqlQuery QMailStoreSql::prepare(const QString& sql)
diff --git a/src/libraries/qmfclient/qmfclient.pro b/src/libraries/qmfclient/qmfclient.pro
index 05993a35..aa0c97c3 100644
--- a/src/libraries/qmfclient/qmfclient.pro
+++ b/src/libraries/qmfclient/qmfclient.pro
@@ -1,5 +1,5 @@
TARGET = QmfClient
-QT = core dbus sql network core5compat
+QT = core dbus sql network
CONFIG += warn_on
MODULE_PLUGIN_TYPES = \
diff --git a/src/libraries/qmfmessageserver/qmailtransport.cpp b/src/libraries/qmfmessageserver/qmailtransport.cpp
index 337702ab..66133700 100644
--- a/src/libraries/qmfmessageserver/qmailtransport.cpp
+++ b/src/libraries/qmfmessageserver/qmailtransport.cpp
@@ -189,13 +189,21 @@ void QMailTransport::createSocket(EncryptType encryptType)
mSocket = new Socket(this);
encryption = encryptType;
connect(mSocket, &QSslSocket::encrypted, this, &QMailTransport::encryptionEstablished);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ connect(mSocket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(connectionFailed(QList<QSslError>)));
+#else
connect(mSocket, &QSslSocket::sslErrors, this, &QMailTransport::connectionFailed);
+#endif
const int bufferLimit = 101*1024; // Limit memory used when downloading
mSocket->setReadBufferSize( bufferLimit );
mSocket->setObjectName(QString::fromUtf8(mName) + QString::fromLatin1("-socket"));
connect(mSocket, &QAbstractSocket::connected, this, &QMailTransport::connectionEstablished);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ connect(mSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
+#else
connect(mSocket, &QAbstractSocket::errorOccurred, this, &QMailTransport::socketError);
+#endif
connect(mSocket, &QAbstractSocket::readyRead, this, &QMailTransport::readyRead);
connect(mSocket, &QAbstractSocket::bytesWritten, this, &QMailTransport::bytesWritten);
diff --git a/src/plugins/messageservices/imap/imap.pro b/src/plugins/messageservices/imap/imap.pro
index 09955b59..d8d34b55 100644
--- a/src/plugins/messageservices/imap/imap.pro
+++ b/src/plugins/messageservices/imap/imap.pro
@@ -39,3 +39,5 @@ qtConfig(system-zlib) {
QT_PRIVATE += zlib-private
}
+# hack longstream work without the private/ on include
+INCLUDEPATH += $$PWD/../../../libraries/qmfmessageserver/
diff --git a/src/plugins/messageservices/pop/pop.pro b/src/plugins/messageservices/pop/pop.pro
index bbbe3c06..0c7297c5 100644
--- a/src/plugins/messageservices/pop/pop.pro
+++ b/src/plugins/messageservices/pop/pop.pro
@@ -17,3 +17,6 @@ SOURCES += popclient.cpp \
poplog.cpp \
popservice.cpp \
popauthenticator.cpp
+
+# hack longstream work without the private/ on include
+INCLUDEPATH += $$PWD/../../../libraries/qmfmessageserver/
diff --git a/src/tools/messageserver/messageserver.pro b/src/tools/messageserver/messageserver.pro
index 1ecfbdf6..34932f25 100644
--- a/src/tools/messageserver/messageserver.pro
+++ b/src/tools/messageserver/messageserver.pro
@@ -10,6 +10,9 @@ contains(DEFINES, USE_HTML_PARSER) {
CONFIG -= app_bundle
target.path += $$QMF_INSTALL_ROOT/bin
+# hack longstream work without the private/ on include
+INCLUDEPATH += $$PWD/../../libraries/qmfmessageserver/
+
HEADERS += messageserver.h \
servicehandler.h
diff --git a/tests/tests.pri b/tests/tests.pri
index 11065508..a4ed42ef 100644
--- a/tests/tests.pri
+++ b/tests/tests.pri
@@ -6,3 +6,7 @@ QT += qmfclient qmfclient-private
target.path += $$QMF_INSTALL_ROOT/tests5
INSTALLS += target
+
+# hack _p.h to work without the private/ on include
+INCLUDEPATH += $$PWD/../src/libraries/qmfclient/
+INCLUDEPATH += $$PWD/../src/libraries/qmfmessageserver/