summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Knauß <knauss@kolabsys.com>2014-08-14 19:23:58 (GMT)
committerSandro Knauß <knauss@kolabsys.com>2014-08-18 12:41:00 (GMT)
commit20558620dad9f490ad7db91dbece6fa6899f660c (patch)
tree4ff4550d064c22576465448c80e23e32fc24ca3f
parentfe11fc5325add5583fd0e0e80a7eaf5fd2dcf105 (diff)
downloadlibcalendaring-20558620dad9f490ad7db91dbece6fa6899f660c.tar.gz
Fix build libcalendering for Qt < 4.7
disable sslserver for tests. We don't use sslserver for tests, so it is save to disable it for Qt < 4.7 BUG: #3224
-rw-r--r--kimap/tests/kimaptest/CMakeLists.txt9
-rw-r--r--kimap/tests/kimaptest/fakeserver.cpp18
2 files changed, 25 insertions, 2 deletions
diff --git a/kimap/tests/kimaptest/CMakeLists.txt b/kimap/tests/kimaptest/CMakeLists.txt
index f3d2b7d..4e3d0ce 100644
--- a/kimap/tests/kimaptest/CMakeLists.txt
+++ b/kimap/tests/kimaptest/CMakeLists.txt
@@ -5,10 +5,17 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
set(kimaptest_LIB_SRCS
fakeserver.cpp
mockjob.cpp
- sslserver.cpp
)
find_package(Qt4 4.6.0 REQUIRED)
+
+# if (QT_VERSION >= 4.7) include sslserver.cpp
+if((QT_VERSION_MINOR GREATER 7) OR (QT_VERSION_MAJOR GREATER 4))
+ set(kimaptest_LIB_SRCS
+ ${kimaptest_LIB_SRCS}
+ sslserver.cpp
+ )
+endif()
include_directories(${QT_INCLUDES})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
QT4_AUTOMOC("${kimaptest_LIB_SRCS}")
diff --git a/kimap/tests/kimaptest/fakeserver.cpp b/kimap/tests/kimaptest/fakeserver.cpp
index 2caea27..f5548cf 100644
--- a/kimap/tests/kimaptest/fakeserver.cpp
+++ b/kimap/tests/kimaptest/fakeserver.cpp
@@ -21,7 +21,10 @@
// Own
#include "fakeserver.h"
-#include "sslserver.h"
+
+#if QT_VERSION >= 0x040700
+ #include "sslserver.h"
+#endif
// Qt
#include <QDebug>
@@ -72,10 +75,15 @@ void FakeServer::dataAvailable()
readClientPart( scenarioNumber );
writeServerPart( scenarioNumber );
+
if (m_starttls) {
+#if QT_VERSION >= 0x040700
m_starttls = false;
qDebug() << "start tls";
static_cast<QSslSocket*>(socket)->startServerEncryption();
+#else
+ qWarning() << "Qt < 4.7 don't support entcrypted FakeServer. Will still use an unencrypted connection.";
+#endif
}
}
@@ -94,17 +102,25 @@ void FakeServer::newConnection()
void FakeServer::setEncrypted( QSsl::SslProtocol protocol )
{
+#if QT_VERSION >= 0x040700
m_encrypted = true;
m_sslProtocol = protocol;
+#else
+ qWarning() << "Qt < 4.7 don't support entcrypted FakeServer. Will still use an unencrypted connection.";
+#endif
}
void FakeServer::run()
{
+#if QT_VERSION >= 0x040700
if (m_encrypted) {
m_tcpServer = new SslServer(m_sslProtocol);
} else {
m_tcpServer = new QTcpServer();
}
+#else
+ m_tcpServer = new QTcpServer();
+#endif
if ( !m_tcpServer->listen( QHostAddress( QHostAddress::LocalHost ), 5989 ) ) {
qFatal( "Unable to start the server" );
}