diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a251e820..48bf9f94e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,172 +1,172 @@ cmake_minimum_required(VERSION 3.5) set(PIM_VERSION "5.11.40") set(KDEPIM_RUNTIME_VERSION_NUMBER ${PIM_VERSION}) project(kdepim-runtime VERSION ${KDEPIM_RUNTIME_VERSION_NUMBER}) if (POLICY CMP0053) cmake_policy(SET CMP0053 NEW) endif() ############### KDEPIM-Runtime version ################ # KDEPIM_RUNTIME_VERSION # Version scheme: "x.y.z build". # # x is the version number. # y is the major release number. # z is the minor release number. # # "x.y.z" follow the kdelibs version kdepim is released with. # # If "z" is 0, it the version is "x.y" # # KDEPIM_DEV_VERSION # is empty for final versions. For development versions "build" is # something like "pre", "", "alpha2", "beta1", "beta2", "rc1", "rc2". # # Examples in chronological order: # # 3.0 # 3.0.1 # 3.1 # 3.1 beta1 # 3.1 beta2 # 3.1 rc1 # 3.1 # 3.1.1 # 3.2 pre # 3.2 set(KDEPIM_DEV_VERSION alpha) # add an extra space if(DEFINED KDEPIM_DEV_VERSION) set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}") endif() set(KDEPIM_RUNTIME_VERSION "${KDEPIM_RUNTIME_VERSION_NUMBER}${KDEPIM_DEV_VERSION}") configure_file(kdepim-runtime-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-runtime-version.h @ONLY) set(KF5_MIN_VERSION "5.58.0") find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${kdepim-runtime_SOURCE_DIR}/cmake/ ${ECM_MODULE_PATH}) include(ECMSetupVersion) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMInstallIcons) include(ECMQtDeclareLoggingCategory) include(GenerateExportHeader) set(QT_REQUIRED_VERSION "5.10.0") set(KDEPIMRUNTIME_LIB_VERSION "${KDEPIM_RUNTIME_VERSION_NUMBER}") set(KDEPIMRUNTIME_LIB_SOVERSION "5") set(AKONADI_VERSION "5.11.40") set(KCONTACTS_LIB_VERSION "5.11.40") -set(KCALENDARCORE_LIB_VERSION "5.11.42") +set(KCALENDARCORE_LIB_VERSION "5.11.43") set(IDENTITYMANAGEMENT_LIB_VERSION "5.11.40") set(KMAILTRANSPORT_LIB_VERSION "5.11.40") set(CALENDARUTILS_LIB_VERSION "5.11.40") set(KDAV_LIB_VERSION "5.11.40") set(KIMAP_LIB_VERSION "5.11.40") set(KMBOX_LIB_VERSION "5.11.40") set(AKONADICALENDAR_LIB_VERSION "5.11.40") set(KONTACTINTERFACE_LIB_VERSION "5.11.40") set(AKONADIKALARM_LIB_VERSION "5.11.40") set(KMIME_LIB_VERSION "5.11.40") set(XMLRPCCLIENT_LIB_VERSION "5.11.40") set(KCONTACTS_LIB_VERSION "5.11.40") set(AKONADIMIME_LIB_VERSION "5.11.40") set(AKONADICONTACT_LIB_VERSION "5.11.40") set(AKONADINOTE_LIB_VERSION "5.11.40") set(PIMCOMMON_LIB_VERSION "5.11.40") set(KGAPI_LIB_VERSION "5.11.40") set( SharedMimeInfo_MINIMUM_VERSION "1.3" ) find_package(SharedMimeInfo ${SharedMimeInfo_MINIMUM_VERSION} REQUIRED) find_package(Sasl2) set_package_properties(Sasl2 PROPERTIES TYPE REQUIRED) find_package(Qca-qt5) option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE) # QT5 package find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED TextToSpeech Network Widgets Test XmlPatterns DBus WebEngineWidgets NetworkAuth) if (NOT Qca-qt5_FOUND) message(STATUS "QCA not found, public key authentication will not be supported") else() add_definitions(-DHAVE_QCA) endif() # KF5 package find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5NotifyConfig ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ItemModels ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5WindowSystem ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) # for KPluralHandlingSpinBox find_package(KF5Notifications ${KF5_MIN_VERSION} CONFIG REQUIRED) # pop3, ews find_package(KF5DocTools ${KF5_MIN_VERSION} CONFIG REQUIRED) # pop3 find_package(KF5Holidays ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5KDELibs4Support ${KF5_MIN_VERSION} CONFIG REQUIRED) # KdepimLibs package find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED) find_package(KPimKDAV ${KDAV_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiContact ${AKONADICONTACT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AlarmCalendar ${AKONADIKALARM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5CalendarCore ${KCALENDARCORE_LIB_VERSION} CONFIG REQUIRED) find_package(KF5CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mbox ${KMBOX_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IMAP ${KIMAP_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiNotes ${AKONADINOTE_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiCalendar ${AKONADICALENDAR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommon ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KPimGAPI ${KGAPI_LIB_VERSION} CONFIG REQUIRED) option(KDEPIM_RUN_ISOLATED_TESTS "Run the isolated tests." FALSE) option(NO_REGENERATE_MIME "Don't regenerate mime file (developer-only option)" FALSE ) #add_definitions( -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 ) find_package(Xsltproc) set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces for all Akonadi resources.") add_subdirectory(resources) add_subdirectory(agents) add_subdirectory(defaultsetup) add_subdirectory(kioslave) add_subdirectory(migration) add_subdirectory(doc) ## install the MIME type spec file for KDEPIM specific MIME types install(FILES kdepim-mime.xml DESTINATION ${KDE_INSTALL_MIMEDIR}) if (NOT NO_REGENERATE_MIME) update_xdg_mimetypes(${KDE_INSTALL_MIMEDIR}) endif() install( FILES kdepim-runtime.renamecategories kdepim-runtime.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES ) diff --git a/resources/kolab/pimkolab/autotests/testutils.h b/resources/kolab/pimkolab/autotests/testutils.h index 9048d2cc5..0edc9f036 100644 --- a/resources/kolab/pimkolab/autotests/testutils.h +++ b/resources/kolab/pimkolab/autotests/testutils.h @@ -1,240 +1,242 @@ /* * Copyright (C) 2012 Christian Mollekopf * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef TESTUTILS_H #define TESTUTILS_H #include #include #include #include #include #include "kolabformat/kolabobject.h" Q_DECLARE_METATYPE(Kolab::ObjectType) Q_DECLARE_METATYPE(Kolab::Version) #define KCOMPARE(actual, expected) \ do { \ if (!(actual == expected)) { \ qDebug() << __FILE__ << ':' << __LINE__ << "Actual: " #actual ": " << actual << "\nExpected: " #expected ": " << expected; \ return false; \ } \ } while (0) #endif #define DIFFCOMPARE(actual, expected) \ do { \ if (!(actual.simplified() == expected.simplified())) { \ qDebug() << "Content not the same."; \ qDebug() << "actual." << actual.simplified() << "\n"; \ qDebug() << "expected." << expected.simplified(); \ showDiff(expected, actual); \ QTest::qFail("Compared versions differ.", __FILE__, __LINE__); \ return; \ } \ } while (0) #define TESTVALUE(type, name) \ *static_cast(QTest::qData(#name, ::qMetaTypeId())) const QString TESTFILEDIR = QString::fromLatin1(TEST_DATA_PATH "/testfiles/"); QString getPath(const char *file) { return TESTFILEDIR+QString::fromLatin1(file); } void showDiff(const QString &expected, const QString &converted) { if (expected.isEmpty() || converted.isEmpty()) { qWarning() << "files are empty"; return; } if (expected == converted) { qWarning() << "contents are the same"; return; } qDebug() << "EXPECTED: " << expected; qDebug() << "CONVERTED: " << converted; } KMime::Message::Ptr readMimeFile(const QString &fileName, bool &ok) { // qDebug() << fileName; QFile file(fileName); ok = file.open(QFile::ReadOnly); if (!ok) { qWarning() << "failed to open file: " << fileName; return KMime::Message::Ptr(); } const QByteArray data = file.readAll(); KMime::Message::Ptr msg = KMime::Message::Ptr(new KMime::Message); msg->setContent(data); msg->parse(); return msg; } void normalizeMimemessage(QString &content) { content.replace(QRegExp(QStringLiteral("\\bLibkolab-\\d.\\d.\\d\\b"), Qt::CaseSensitive), QStringLiteral("Libkolab-x.x.x")); content.replace(QRegExp(QStringLiteral("\\bLibkolabxml-\\d.\\d.\\d\\b"), Qt::CaseSensitive), QStringLiteral("Libkolabxml-x.x.x")); content.replace(QRegExp(QStringLiteral("\\bLibkolab-\\d.\\d\\b"), Qt::CaseSensitive), QStringLiteral("Libkolab-x.x.x")); content.replace(QRegExp(QStringLiteral("\\bkdepim-runtime-\\d.\\d\\b"), Qt::CaseSensitive), QStringLiteral("Libkolab-x.x.x")); content.replace(QRegExp(QStringLiteral("\\bLibkolabxml-\\d.\\d\\b"), Qt::CaseSensitive), QStringLiteral("Libkolabxml-x.x.x")); content.replace(QRegExp(QStringLiteral("cid:*@kolab.resource.akonadi"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("cid:id@kolab.resource.akonadi")); content.replace(QRegExp(QStringLiteral("Content-ID: <*@kolab.resource.akonadi>"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("Content-ID: ")); content.replace(QRegExp(QStringLiteral("mailto:*"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("mailto:")); content.replace(QRegExp(QStringLiteral("mailto:*"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("mailto:")); content.replace(QRegExp(QStringLiteral("data:*"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("data:")); content.replace(QRegExp(QStringLiteral("*"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("")); //We no longer support pobox, so remove pobox lines content.replace(QRegExp(QStringLiteral("*"), Qt::CaseSensitive, QRegExp::Wildcard), QLatin1String("")); content.replace(QRegExp(QStringLiteral("*"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("")); content.replace(QRegExp(QStringLiteral("*"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("")); content.replace(QRegExp(QStringLiteral("--nextPart\\S*"), Qt::CaseSensitive), QStringLiteral("--part")); content.replace(QRegExp(QStringLiteral("\\bboundary=\"nextPart[^\\n]*"), Qt::CaseSensitive), QStringLiteral("boundary")); content.replace(QRegExp(QStringLiteral("Date[^\\n]*"), Qt::CaseSensitive), QStringLiteral("Date")); //The sort order of the attributes in kolabV2 is unpredictable content.replace(QRegExp(QStringLiteral(""), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("")); //quoted-printable encoding changes where the linebreaks are every now and then (an all are valid), so we remove the linebreaks content.replace(QRegExp(QStringLiteral("=\\n"), Qt::CaseSensitive), QLatin1String("")); } QString normalizeVCardMessage(QString content) { //The encoding changes every now and then content.replace(QRegExp(QStringLiteral("ENCODING=b;TYPE=png:*"), Qt::CaseSensitive, QRegExp::Wildcard), QStringLiteral("ENCODING=b;TYPE=png:picturedata")); return content; } //Normalize incidences for comparison void normalizeIncidence(KCalCore::Incidence::Ptr incidence) { //The UID is not persistent (it's just the internal pointer), therefore we clear it //TODO make sure that the UID does really not need to be persistent - foreach (KCalCore::Attendee::Ptr attendee, incidence->attendees()) { + auto attendees = incidence->attendees(); + for (auto &attendee : attendees) { attendee->setUid(QString()); } + incidence->setAttendees(attendees); //FIXME even if hasDueDate can differ, it shouldn't because it breaks equality. Check why they differ in the first place. if (incidence->type() == KCalCore::IncidenceBase::TypeTodo) { KCalCore::Todo::Ptr todo = incidence.dynamicCast(); Q_ASSERT(todo.data()); if (!todo->hasDueDate() && !todo->hasStartDate()) { todo->setAllDay(false); // all day has no meaning if there are no start and due dates but may differ nevertheless } } } template class Op, typename T> static bool LexicographicalCompare(const T &_x, const T &_y) { T x(_x); x.setId(QString()); T y(_y); y.setId(QString()); Op op; return op(x.toString(), y.toString()); } bool normalizePhoneNumbers(KContacts::Addressee &addressee, KContacts::Addressee &refAddressee) { KContacts::PhoneNumber::List phoneNumbers = addressee.phoneNumbers(); KContacts::PhoneNumber::List refPhoneNumbers = refAddressee.phoneNumbers(); if (phoneNumbers.size() != refPhoneNumbers.size()) { return false; } std::sort(phoneNumbers.begin(), phoneNumbers.end(), LexicographicalCompare ); std::sort(refPhoneNumbers.begin(), refPhoneNumbers.end(), LexicographicalCompare ); for (int i = 0; i < phoneNumbers.size(); ++i) { KContacts::PhoneNumber phoneNumber = phoneNumbers.at(i); const KContacts::PhoneNumber refPhoneNumber = refPhoneNumbers.at(i); KCOMPARE(LexicographicalCompare(phoneNumber, refPhoneNumber), true); addressee.removePhoneNumber(phoneNumber); phoneNumber.setId(refPhoneNumber.id()); addressee.insertPhoneNumber(phoneNumber); //Make sure that both have the same sorted order refAddressee.removePhoneNumber(refPhoneNumber); refAddressee.insertPhoneNumber(refPhoneNumber); } // for ( int i = 0; i < phoneNumbers.size(); ++i ) { // qDebug() << "--------------------------------------"; // qDebug() << addressee.phoneNumbers().at(i).toString(); // qDebug() << refAddressee.phoneNumbers().at(i).toString(); // } return true; } bool normalizeAddresses(KContacts::Addressee &addressee, const KContacts::Addressee &refAddressee) { KContacts::Address::List addresses = addressee.addresses(); KContacts::Address::List refAddresses = refAddressee.addresses(); if (addresses.size() != refAddresses.size()) { return false; } std::sort(addresses.begin(), addresses.end(), LexicographicalCompare ); std::sort(refAddresses.begin(), refAddresses.end(), LexicographicalCompare ); for (int i = 0; i < addresses.size(); ++i) { KContacts::Address address = addresses.at(i); const KContacts::Address refAddress = refAddresses.at(i); KCOMPARE(LexicographicalCompare(address, refAddress), true); addressee.removeAddress(address); address.setId(refAddress.id()); addressee.insertAddress(address); } return true; } void normalizeContact(KContacts::Addressee &addressee) { const KContacts::Address::List addresses = addressee.addresses(); for (KContacts::Address a : addresses) { addressee.removeAddress(a); a.setPostOfficeBox(QString()); //Not supported anymore addressee.insertAddress(a); } addressee.setSound(KContacts::Sound()); //Sound is not supported addressee.removeCustom(QStringLiteral("KOLAB"), QStringLiteral("CreationDate")); //The creation date is no longer existing //Attachment names are no longer required because we identify the parts by cid and no longer by name addressee.removeCustom(QStringLiteral("KOLAB"), QStringLiteral("LogoAttachmentName")); addressee.removeCustom(QStringLiteral("KOLAB"), QStringLiteral("PictureAttachmentName")); addressee.removeCustom(QStringLiteral("KOLAB"), QStringLiteral("SoundAttachmentName")); } Kolab::Event createEvent(const Kolab::cDateTime &start, const Kolab::cDateTime &end) { Kolab::Event event; event.setUid(QUuid::createUuid().toString().toStdString()); event.setStart(start); event.setEnd(end); return event; }