diff --git a/CMakeLists.txt b/CMakeLists.txt index fd022e1..1a54a8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,84 +1,84 @@ cmake_minimum_required(VERSION 3.5) set(PIM_VERSION "5.13.40") project(libkdav VERSION ${PIM_VERSION}) set(LIBKDAV_VERSION ${PIM_VERSION}) set(KF5_MIN_VERSION "5.66.0") find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(CMakeFindDependencyMacro) include(ECMSetupVersion) include(GenerateExportHeader) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(FeatureSummary) include(ECMAddTests) include(ECMInstallIcons) include(ECMQtDeclareLoggingCategory) set(QT_REQUIRED_VERSION "5.12.0") find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core Gui XmlPatterns Test) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED CoreAddons KIO I18n) # setup lib if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000) endif() add_definitions(-DQT_NO_FOREACH) ecm_setup_version(${LIBKDAV_VERSION} VARIABLE_PREFIX KDAV - VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kpimkdav_version.h" - PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KPimKDAVConfigVersion.cmake" + VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kdav_version.h" + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5DAVConfigVersion.cmake" SOVERSION 5 ) -set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KPimKDAV") +set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5DAV") configure_package_config_file( - "${CMAKE_CURRENT_SOURCE_DIR}/KPimKDAVConfig.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/KPimKDAVConfig.cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/KF5DAVConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/KF5DAVConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/KPimKDAVConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/KPimKDAVConfigVersion.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/KF5DAVConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/KF5DAVConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) -install(EXPORT KPimKDAVTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KPimKDAVTargets.cmake NAMESPACE KPim::) +install(EXPORT KF5DAVTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5DAVTargets.cmake NAMESPACE KF5::) install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/kpimkdav_version.h - DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim COMPONENT Devel + ${CMAKE_CURRENT_BINARY_DIR}/kdav_version.h + DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KF5 COMPONENT Devel ) install(FILES kdav.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) add_subdirectory(src) if(BUILD_TESTING) add_subdirectory(autotests) add_subdirectory(test) endif() feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES ) diff --git a/KPimKDAVConfig.cmake.in b/KF5DAVConfig.cmake.in similarity index 63% rename from KPimKDAVConfig.cmake.in rename to KF5DAVConfig.cmake.in index 6d197ea..77f7bbb 100644 --- a/KPimKDAVConfig.cmake.in +++ b/KF5DAVConfig.cmake.in @@ -1,6 +1,6 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(KF5CoreAddons "@KF5_MIN_VERSION@") -include("${CMAKE_CURRENT_LIST_DIR}/KPimKDAVTargets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/KF5DAVTargets.cmake") diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 20106c1..e839c3e 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,32 +1,32 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) add_definitions(-DAUTOTEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data") ecm_add_test(davcollectiontest.cpp TEST_NAME davcollection NAME_PREFIX "kdav-" - LINK_LIBRARIES KPim::KDAV Qt5::Test Qt5::Core Qt5::Gui + LINK_LIBRARIES KF5::DAV Qt5::Test Qt5::Core Qt5::Gui ) ecm_add_test(davitemtest.cpp TEST_NAME davitem NAME_PREFIX "kdav-" - LINK_LIBRARIES KPim::KDAV Qt5::Test Qt5::Core + LINK_LIBRARIES KF5::DAV Qt5::Test Qt5::Core ) ecm_add_test(davurltest.cpp TEST_NAME davurl NAME_PREFIX "kdav-" - LINK_LIBRARIES KPim::KDAV Qt5::Test Qt5::Core + LINK_LIBRARIES KF5::DAV Qt5::Test Qt5::Core ) ecm_add_test(davitemfetchjobtest.cpp fakeserver.cpp TEST_NAME davitemfetchjob NAME_PREFIX "kdav-" - LINK_LIBRARIES KPim::KDAV Qt5::Test Qt5::Core Qt5::Network + LINK_LIBRARIES KF5::DAV Qt5::Test Qt5::Core Qt5::Network ) ecm_add_test(davitemslistjobtest.cpp fakeserver.cpp TEST_NAME davitemslistjob NAME_PREFIX "kdav-" - LINK_LIBRARIES KPim::KDAV Qt5::Test Qt5::Core Qt5::Network + LINK_LIBRARIES KF5::DAV Qt5::Test Qt5::Core Qt5::Network ) diff --git a/metainfo.yaml b/metainfo.yaml index 4b3f0dc..0583613 100644 --- a/metainfo.yaml +++ b/metainfo.yaml @@ -1,16 +1,16 @@ maintainer: fancyname: KDAV description: The KDav library type: functional platforms: - name: All portingAid: false deprecated: false release: false libraries: - - qmake: PimKDAV - cmake: "KPimKDAV" -cmakename: KPimKDAV + - qmake: KDAV + cmake: "KF5DAV" +cmakename: KF5DAV public_lib: true group: kdepim diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 13186b7..1751142 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,130 +1,129 @@ add_definitions(-DTRANSLATION_DOMAIN=\"libkdav\") include_directories( common/ protocols/ ) ########### next target ############### set(libkdav_SRCS common/davjobbase.cpp common/davcollection.cpp common/davcollectiondeletejob.cpp common/davcollectionsfetchjob.cpp common/davcollectionmodifyjob.cpp common/davcollectionsmultifetchjob.cpp common/davprotocolbase.cpp common/daverror.cpp common/davitem.cpp common/davitemcreatejob.cpp common/davitemdeletejob.cpp common/davitemfetchjob.cpp common/davitemmodifyjob.cpp common/davitemsfetchjob.cpp common/davitemslistjob.cpp common/davmanager.cpp common/davmultigetprotocol.cpp common/davprincipalhomesetsfetchjob.cpp common/davprincipalsearchjob.cpp common/protocolinfo.cpp common/davurl.cpp common/utils.cpp common/etagcache.cpp protocols/groupdavprotocol.cpp #KContacts protocols/carddavprotocol.cpp #KCalCore protocols/caldavprotocol.cpp ) ecm_generate_headers(KDAV_Camelcase_HEADERS HEADER_NAMES DavJobBase DavCollection DavCollectionDeleteJob DavCollectionsFetchJob DavCollectionModifyJob DavCollectionsMultiFetchJob DavError DavItem DavItemCreateJob DavItemDeleteJob DavItemFetchJob DavItemModifyJob DavItemsFetchJob DavItemsListJob DavPrincipalHomesetsFetchJob DavPrincipalSearchJob DavUrl Enums EtagCache ProtocolInfo REQUIRED_HEADERS KDAV_HEADERS PREFIX KDAV RELATIVE common ) install(FILES ${KDAV_Camelcase_HEADERS} - DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim/KDAV + DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KF5/KDAV COMPONENT Devel ) install(FILES ${KDAV_HEADERS} - ${CMAKE_CURRENT_BINARY_DIR}/kpimkdav_export.h + ${CMAKE_CURRENT_BINARY_DIR}/kdav_export.h - DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim/kdav + DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KF5/kdav COMPONENT Devel ) ecm_generate_pri_file(BASE_NAME kdav - LIB_NAME KPimKDAV + LIB_NAME KF5DAV FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR}/KDAV ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR} ) ecm_qt_declare_logging_category(libkdav_SRCS HEADER libkdav_debug.h IDENTIFIER KDAV_LOG CATEGORY_NAME org.kde.pim.kdav) -add_library(KPimKDAV +add_library(KF5DAV ${libkdav_SRCS} ) -generate_export_header(KPimKDAV BASE_NAME kpimkdav) +generate_export_header(KF5DAV BASE_NAME kdav) -add_library(KPim::KDAV ALIAS KPimKDAV) +add_library(KF5::DAV ALIAS KF5DAV) -target_link_libraries(KPimKDAV +target_link_libraries(KF5DAV PUBLIC KF5::CoreAddons PRIVATE Qt5::Xml Qt5::Gui Qt5::XmlPatterns KF5::KIOCore KF5::I18n ) -set_target_properties(KPimKDAV PROPERTIES +set_target_properties(KF5DAV PROPERTIES VERSION ${KDAV_VERSION_STRING} SOVERSION ${KDAV_SOVERSION} - EXPORT_NAME KDAV + EXPORT_NAME DAV ) install(TARGETS - KPimKDAV - EXPORT KPimKDAVTargets + KF5DAV + EXPORT KF5DAVTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) -target_include_directories(KPimKDAV INTERFACE "$") - +target_include_directories(KF5DAV INTERFACE "$") diff --git a/src/common/davcollection.h b/src/common/davcollection.h index 5ea5216..dc28754 100644 --- a/src/common/davcollection.h +++ b/src/common/davcollection.h @@ -1,154 +1,154 @@ /* Copyright (c) 2009 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVCOLLECTION_H #define KDAV_DAVCOLLECTION_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "enums.h" #include #include #include class QColor; class DavCollectionPrivate; namespace KDAV { class DavUrl; } namespace KDAV { /** * @short A helper class to store information about DAV collection. * * This class is used as container to transfer information about DAV * collections between the Akonadi resource and the DAV jobs. */ -class KPIMKDAV_EXPORT DavCollection +class KDAV_EXPORT DavCollection { public: /** * Defines a list of DAV collection objects. */ typedef QVector List; /** * Describes the possible content type of the DAV collection. */ enum ContentType { Events = 1, ///< The collection can contain event DAV resources. Todos = 2, ///< The collection can contain todo DAV resources. Contacts = 4, ///< The collection can contain contact DAV resources. FreeBusy = 8, ///< The collection can contain free/busy information. Journal = 16, ///< The collection can contain journal DAV resources. Calendar = 32 ///< The collection can contain anything calendar-related. }; Q_DECLARE_FLAGS(ContentTypes, ContentType) /** * Creates an empty DAV collection. */ DavCollection(); /** * Creates a new DAV collection. * * @param url The url that identifies the collection. * @param displayName The display name of the collection. * @param contentTypes The possible content types of the collection. */ DavCollection(const DavUrl &url, const QString &displayName, ContentTypes contentTypes); DavCollection(const DavCollection &other); DavCollection &operator=(const DavCollection &other); ~DavCollection(); /** * Sets this collection CTag. */ void setCTag(const QString &ctag); /** * Returns this collection CTag. The returned value will be empty * if no CTag was found. */ Q_REQUIRED_RESULT QString CTag() const; /** * Sets the @p url that identifies the collection. */ void setUrl(const DavUrl &url); /** * Returns the url that identifies the collection. */ Q_REQUIRED_RESULT DavUrl url() const; /** * Sets the display @p name of the collection. */ void setDisplayName(const QString &name); /** * Returns the display name of the collection. */ Q_REQUIRED_RESULT QString displayName() const; /** * Sets the color for this collection */ void setColor(const QColor &color); /** * Return the color of the collection, or an empty string if * none was provided by the backend. */ Q_REQUIRED_RESULT QColor color() const; /** * Sets the possible content @p types of the collection. */ void setContentTypes(ContentTypes types); /** * Returns the possible content types of the collection. */ Q_REQUIRED_RESULT ContentTypes contentTypes() const; /** * Sets the privileges on this collection. */ void setPrivileges(Privileges privs); /** * Returns the privileges on this collection. */ Q_REQUIRED_RESULT Privileges privileges() const; private: QSharedDataPointer d; }; } Q_DECLARE_OPERATORS_FOR_FLAGS(KDAV::DavCollection::ContentTypes) Q_DECLARE_TYPEINFO(KDAV::DavCollection, Q_MOVABLE_TYPE); #endif diff --git a/src/common/davcollectiondeletejob.h b/src/common/davcollectiondeletejob.h index 50de70d..69ba73f 100644 --- a/src/common/davcollectiondeletejob.h +++ b/src/common/davcollectiondeletejob.h @@ -1,62 +1,62 @@ /* Copyright (c) 2010 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVCOLLECTIONDELETEJOB_H #define KDAV_DAVCOLLECTIONDELETEJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davjobbase.h" #include "davurl.h" #include namespace KDAV { class DavCollectionDeleteJobPrivate; /** * @short A job that deletes a DAV collection. * * This job is used to delete a DAV collection at a certain URL. */ -class KPIMKDAV_EXPORT DavCollectionDeleteJob : public DavJobBase +class KDAV_EXPORT DavCollectionDeleteJob : public DavJobBase { Q_OBJECT public: /** * Creates a new DAV collection delete job. * * @param url The dav url of the collection to delete * @param parent The parent object. */ explicit DavCollectionDeleteJob(const DavUrl &url, QObject *parent = nullptr); /** * Starts the job. */ void start() override; private Q_SLOTS: void davJobFinished(KJob *); private: Q_DECLARE_PRIVATE(DavCollectionDeleteJob) }; } #endif diff --git a/src/common/davcollectionmodifyjob.h b/src/common/davcollectionmodifyjob.h index 99e3328..9d8cddc 100644 --- a/src/common/davcollectionmodifyjob.h +++ b/src/common/davcollectionmodifyjob.h @@ -1,78 +1,78 @@ /* Copyright (c) 2010 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVCOLLECTIONMODIFYJOB_H #define KDAV_DAVCOLLECTIONMODIFYJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davjobbase.h" #include "davurl.h" #include namespace KDAV { class DavCollectionModifyJobPrivate; /** * @short A job that modifies a DAV collection. * * This job is used to modify a property of a DAV collection * on the DAV server. */ -class KPIMKDAV_EXPORT DavCollectionModifyJob : public DavJobBase +class KDAV_EXPORT DavCollectionModifyJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav collection modify job. * * @param url The DAV url that identifies the collection. * @param parent The parent object. */ explicit DavCollectionModifyJob(const DavUrl &url, QObject *parent = nullptr); /** * Sets the property that shall be modified by the job. * * @param property The name of the property. * @param value The value of the property. * @param ns The XML namespace that shall be used for the property name. */ void setProperty(const QString &property, const QString &value, const QString &ns = QString()); /** * Sets the property that shall be removed by the job. * * @param property The name of the property. * @param ns The XML namespace that shall be used for the property name. */ void removeProperty(const QString &property, const QString &ns); /** * Starts the job. */ void start() override; private: void davJobFinished(KJob *job); Q_DECLARE_PRIVATE(DavCollectionModifyJob) }; } #endif diff --git a/src/common/davcollectionsfetchjob.h b/src/common/davcollectionsfetchjob.h index 4e929f0..4522f1e 100644 --- a/src/common/davcollectionsfetchjob.h +++ b/src/common/davcollectionsfetchjob.h @@ -1,85 +1,85 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVCOLLECTIONSFETCHJOB_H #define KDAV_DAVCOLLECTIONSFETCHJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davcollection.h" #include "davjobbase.h" #include "davurl.h" #include namespace KDAV { class DavCollectionsFetchJobPrivate; /** * @short A job that fetches all DAV collection. * * This job is used to fetch all DAV collection that are available * under a certain DAV url. */ -class KPIMKDAV_EXPORT DavCollectionsFetchJob : public DavJobBase +class KDAV_EXPORT DavCollectionsFetchJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav collections fetch job. * * @param url The DAV url of the DAV collection whose sub collections shall be fetched. * @param parent The parent object. */ explicit DavCollectionsFetchJob(const DavUrl &url, QObject *parent = nullptr); /** * Starts the job. */ void start() override; /** * Returns the list of fetched DAV collections. */ Q_REQUIRED_RESULT DavCollection::List collections() const; /** * Return the DavUrl used by this job */ Q_REQUIRED_RESULT DavUrl davUrl() const; Q_SIGNALS: /** * This signal is emitted every time a new collection has been discovered. * * @param collectionUrl The URL of the discovered collection * @param configuredUrl The URL given to the job */ void collectionDiscovered(int protocol, const QString &collectionUrl, const QString &configuredUrl); private: void principalFetchFinished(KJob *); void collectionsFetchFinished(KJob *); void doCollectionsFetch(const QUrl &url); void subjobFinished(); Q_DECLARE_PRIVATE(DavCollectionsFetchJob) }; } #endif diff --git a/src/common/davcollectionsmultifetchjob.h b/src/common/davcollectionsmultifetchjob.h index 4640e68..9a38bd8 100644 --- a/src/common/davcollectionsmultifetchjob.h +++ b/src/common/davcollectionsmultifetchjob.h @@ -1,82 +1,82 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVCOLLECTIONSMULTIFETCHJOB_H #define KDAV_DAVCOLLECTIONSMULTIFETCHJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davcollection.h" #include "davurl.h" #include #include namespace KDAV { class DavCollectionsMultiFetchJobPrivate; /** * @short A job that fetches all DAV collection. * * This job is used to fetch all DAV collection that are available * under a certain list of DAV urls. * * @note This class just combines multiple calls of DavCollectionsFetchJob * into one job. */ -class KPIMKDAV_EXPORT DavCollectionsMultiFetchJob : public KJob +class KDAV_EXPORT DavCollectionsMultiFetchJob : public KJob { Q_OBJECT public: /** * Creates a new dav collections multi fetch job. * * @param urls The list of DAV urls whose sub collections shall be fetched. * @param parent The parent object. */ explicit DavCollectionsMultiFetchJob(const DavUrl::List &urls, QObject *parent = nullptr); ~DavCollectionsMultiFetchJob(); /** * Starts the job. */ void start() override; /** * Returns the list of fetched DAV collections. */ Q_REQUIRED_RESULT DavCollection::List collections() const; Q_SIGNALS: /** * This signal is emitted every time a new collection has been discovered. * * @param collectionUrl The URL of the discovered collection * @param configuredUrl The URL given to the job */ void collectionDiscovered(int protocol, const QString &collectionUrl, const QString &configuredUrl); private: void davJobFinished(KJob *); const std::unique_ptr d; }; } #endif diff --git a/src/common/daverror.h b/src/common/daverror.h index 7612002..bc9532a 100644 --- a/src/common/daverror.h +++ b/src/common/daverror.h @@ -1,73 +1,73 @@ /* Copyright (c) 2016 Sandro Knauß This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVERROR_H #define KDAV_DAVERROR_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include #include #include namespace KDAV { /** DAV operation error codes. */ enum ErrorNumber { NO_ERR = 0, ERR_PROBLEM_WITH_REQUEST = KJob::UserDefinedError + 200, //it would be better to request KIO about uts UserDefinedError space. ERR_NO_MULTIGET, ERR_SERVER_UNRECOVERABLE, ERR_COLLECTIONDELETE = ERR_PROBLEM_WITH_REQUEST + 10, ERR_COLLECTIONFETCH = ERR_PROBLEM_WITH_REQUEST + 20, ERR_COLLECTIONFETCH_XQUERY_SETFOCUS, ERR_COLLECTIONFETCH_XQUERY_INVALID, ERR_COLLECTIONMODIFY = ERR_PROBLEM_WITH_REQUEST + 30, ERR_COLLECTIONMODIFY_NO_PROPERITES, ERR_COLLECTIONMODIFY_RESPONSE, ERR_ITEMCREATE = ERR_PROBLEM_WITH_REQUEST + 100, ERR_ITEMDELETE = ERR_PROBLEM_WITH_REQUEST + 110, ERR_ITEMMODIFY = ERR_PROBLEM_WITH_REQUEST + 120, ERR_ITEMLIST = ERR_PROBLEM_WITH_REQUEST + 130, ERR_ITEMLIST_NOMIMETYPE }; class ErrorPrivate; /** DAV operation error. */ -class KPIMKDAV_EXPORT Error +class KDAV_EXPORT Error { public: explicit Error(); explicit Error(ErrorNumber errNo, int responseCode, const QString &errorText, int jobErrorCode); Error(const Error&); ~Error(); Error& operator=(const Error&); Q_REQUIRED_RESULT ErrorNumber errorNumber() const; Q_REQUIRED_RESULT int responseCode() const; Q_REQUIRED_RESULT QString internalErrorText() const; Q_REQUIRED_RESULT int jobErrorCode() const; Q_REQUIRED_RESULT QString translatedJobError() const; Q_REQUIRED_RESULT QString errorText() const; private: QSharedDataPointer d; }; } #endif diff --git a/src/common/davitem.h b/src/common/davitem.h index 3d2cb03..8691421 100644 --- a/src/common/davitem.h +++ b/src/common/davitem.h @@ -1,123 +1,123 @@ /* Copyright (c) 2009 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVITEM_H #define KDAV_DAVITEM_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include #include #include #include #include class DavItemPrivate; namespace KDAV { class DavUrl; } namespace KDAV { /** * @short A helper class to store information about DAV resources. * * This class is used as container to transfer information about DAV * resources between the Akonadi resource and the DAV jobs. * * @note While the DAV RFC names them DAV resource we call them items * to comply to Akonadi terminology. */ -class KPIMKDAV_EXPORT DavItem +class KDAV_EXPORT DavItem { public: /** * Defines a list of DAV item objects. */ typedef QVector List; /** * Creates an empty DAV item. */ DavItem(); /** * Creates a new DAV item. * * @param url The url that identifies the item. * @param contentType The content type of the item. * @param data The actual raw content data of the item. * @param etag The etag of the item. */ DavItem(const DavUrl &url, const QString &contentType, const QByteArray &data, const QString &etag); DavItem(const DavItem &other); DavItem &operator=(const DavItem &other); ~DavItem(); /** * Sets the @p url that identifies the item. */ void setUrl(const DavUrl &url); /** * Returns the url that identifies the item. */ Q_REQUIRED_RESULT DavUrl url() const; /** * Sets the content @p type of the item. */ void setContentType(const QString &type); /** * Returns the content type of the item. */ Q_REQUIRED_RESULT QString contentType() const; /** * Sets the raw content @p data of the item. */ void setData(const QByteArray &data); /** * Returns the raw content data of the item. */ Q_REQUIRED_RESULT QByteArray data() const; /** * Sets the @p etag of the item. */ void setEtag(const QString &etag); /** * Returns the etag of the item. */ Q_REQUIRED_RESULT QString etag() const; private: QSharedDataPointer d; }; -KPIMKDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavItem &item); -KPIMKDAV_EXPORT QDataStream &operator>>(QDataStream &in, DavItem &item); +KDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavItem &item); +KDAV_EXPORT QDataStream &operator>>(QDataStream &in, DavItem &item); } Q_DECLARE_TYPEINFO(KDAV::DavItem, Q_MOVABLE_TYPE); #endif diff --git a/src/common/davitemcreatejob.h b/src/common/davitemcreatejob.h index baa5753..7027111 100644 --- a/src/common/davitemcreatejob.h +++ b/src/common/davitemcreatejob.h @@ -1,67 +1,67 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVITEMCREATEJOB_H #define KDAV_DAVITEMCREATEJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davitem.h" #include "davjobbase.h" #include "davurl.h" namespace KDAV { class DavItemCreateJobPrivate; /** * @short A job to create a DAV item on the DAV server. */ -class KPIMKDAV_EXPORT DavItemCreateJob : public DavJobBase +class KDAV_EXPORT DavItemCreateJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav item create job. * * @param item The item that shall be created. * @param parent The parent object. */ explicit DavItemCreateJob(const DavItem &item, QObject *parent = nullptr); /** * Starts the job. */ void start() override; /** * Returns the created DAV item including the correct identifier url * and current etag information. */ Q_REQUIRED_RESULT DavItem item() const; Q_REQUIRED_RESULT QUrl itemUrl() const; private: void davJobFinished(KJob *); void itemRefreshed(KJob *); Q_DECLARE_PRIVATE(DavItemCreateJob) }; } #endif diff --git a/src/common/davitemdeletejob.h b/src/common/davitemdeletejob.h index bac80f0..f2ee8f8 100644 --- a/src/common/davitemdeletejob.h +++ b/src/common/davitemdeletejob.h @@ -1,69 +1,69 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVITEMDELETEJOB_H #define KDAV_DAVITEMDELETEJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davitem.h" #include "davjobbase.h" #include "davurl.h" namespace KDAV { class DavItemDeleteJobPrivate; /** * @short A job to delete a DAV item on the DAV server. */ -class KPIMKDAV_EXPORT DavItemDeleteJob : public DavJobBase +class KDAV_EXPORT DavItemDeleteJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav item delete job. * * @param item The item that shall be deleted. * @param parent The parent object. */ explicit DavItemDeleteJob(const DavItem &item, QObject *parent = nullptr); /** * Starts the job. */ void start() override; /** * Returns the item that triggered the conflict, if any. */ Q_REQUIRED_RESULT DavItem freshItem() const; /** * Returns the response code we got when fetching the fresh item. */ Q_REQUIRED_RESULT int freshResponseCode() const; private: void davJobFinished(KJob *); void conflictingItemFetched(KJob *); Q_DECLARE_PRIVATE(DavItemDeleteJob) }; } #endif diff --git a/src/common/davitemfetchjob.h b/src/common/davitemfetchjob.h index 6c5d0d9..20f850d 100644 --- a/src/common/davitemfetchjob.h +++ b/src/common/davitemfetchjob.h @@ -1,62 +1,62 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVITEMFETCHJOB_H #define KDAV_DAVITEMFETCHJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davitem.h" #include "davjobbase.h" #include "davurl.h" namespace KDAV { class DavItemFetchJobPrivate; /** * @short A job that fetches a DAV item from the DAV server. */ -class KPIMKDAV_EXPORT DavItemFetchJob : public DavJobBase +class KDAV_EXPORT DavItemFetchJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav item fetch job. * * @param item The item that shall be fetched. * @param parent The parent object. */ explicit DavItemFetchJob(const DavItem &item, QObject *parent = nullptr); /** * Starts the job. */ void start() override; /** * Returns the fetched item including current etag information. */ Q_REQUIRED_RESULT DavItem item() const; private: void davJobFinished(KJob *); Q_DECLARE_PRIVATE(DavItemFetchJob) }; } #endif diff --git a/src/common/davitemmodifyjob.h b/src/common/davitemmodifyjob.h index f66690f..61f4d9d 100644 --- a/src/common/davitemmodifyjob.h +++ b/src/common/davitemmodifyjob.h @@ -1,77 +1,77 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVITEMMODIFYJOB_H #define KDAV_DAVITEMMODIFYJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davitem.h" #include "davjobbase.h" #include "davurl.h" namespace KDAV { class DavItemModifyJobPrivate; /** * @short A job that modifies a DAV item on the DAV server. */ -class KPIMKDAV_EXPORT DavItemModifyJob : public DavJobBase +class KDAV_EXPORT DavItemModifyJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav item modify job. * * @param item The item that shall be modified. * @param parent The parent object. */ explicit DavItemModifyJob(const DavItem &item, QObject *parent = nullptr); /** * Starts the job. */ void start() override; /** * Returns the modified item including the updated etag information. */ Q_REQUIRED_RESULT DavItem item() const; Q_REQUIRED_RESULT QUrl itemUrl() const; /** * Returns the item that triggered the conflict, if any. */ Q_REQUIRED_RESULT DavItem freshItem() const; /** * Returns the response code we got when fetching the fresh item. */ Q_REQUIRED_RESULT int freshResponseCode() const; private: void davJobFinished(KJob *); void itemRefreshed(KJob *); void conflictingItemFetched(KJob *); Q_DECLARE_PRIVATE(DavItemModifyJob) }; } #endif diff --git a/src/common/davitemsfetchjob.h b/src/common/davitemsfetchjob.h index ad5bd7d..7e25f59 100644 --- a/src/common/davitemsfetchjob.h +++ b/src/common/davitemsfetchjob.h @@ -1,72 +1,72 @@ /* Copyright (c) 2010 Grégory Oestreicher Based on DavItemsListJob which is copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVITEMSFETCHJOB_H #define KDAV_DAVITEMSFETCHJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davitem.h" #include "davjobbase.h" #include "davurl.h" #include #include namespace KDAV { class DavItemsFetchJobPrivate; /** * @short A job that fetches a list of items from a DAV server using a multiget query. */ -class KPIMKDAV_EXPORT DavItemsFetchJob : public DavJobBase +class KDAV_EXPORT DavItemsFetchJob : public DavJobBase { Q_OBJECT public: /** * Creates a new items fetch job. * * @param collectionUrl The DAV collection on which to run the query * @param urls The list of urls to fetch * @param parent The parent object */ DavItemsFetchJob(const DavUrl &collectionUrl, const QStringList &urls, QObject *parent = nullptr); /** * Starts the job. */ void start() override; /** * Returns the list of fetched items */ Q_REQUIRED_RESULT DavItem::List items() const; /** * Return the item found at @p url */ Q_REQUIRED_RESULT DavItem item(const QString &url) const; private: void davJobFinished(KJob *); Q_DECLARE_PRIVATE(DavItemsFetchJob) }; } #endif diff --git a/src/common/davitemslistjob.h b/src/common/davitemslistjob.h index 7a60a76..8deeb4e 100644 --- a/src/common/davitemslistjob.h +++ b/src/common/davitemslistjob.h @@ -1,98 +1,98 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVITEMSLISTJOB_H #define KDAV_DAVITEMSLISTJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davitem.h" #include "davjobbase.h" #include #include namespace KDAV { class EtagCache; class DavUrl; class DavItemsListJobPrivate; /** * @short A job that lists all DAV items inside a DAV collection. */ -class KPIMKDAV_EXPORT DavItemsListJob : public DavJobBase +class KDAV_EXPORT DavItemsListJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav items list job. * * @param url The url of the DAV collection. * @param parent The parent object. */ DavItemsListJob(const DavUrl &url, const std::shared_ptr &cache, QObject *parent = nullptr); ~DavItemsListJob() override; /** * Limits the mime types of the items requested. * * If no mime type is given then all will be requested. * * @param types The list of mime types to include */ void setContentMimeTypes(const QStringList &types); /** * Sets the start and end time to list items for. * * @param start The range start, in format "date with UTC time" * @param end The range end, in format "date with UTC time" */ void setTimeRange(const QString &start, const QString &end); /** * Starts the job. */ void start() override; /** * Returns the list of items seen including identifier url and etag information. */ Q_REQUIRED_RESULT DavItem::List items() const; /** * Returns the list of items that were changed on the server. */ Q_REQUIRED_RESULT DavItem::List changedItems() const; /** * Returns the list of items URLs that were not seen in the backend. * As this is based on the etag cache this may contain dependent items. */ Q_REQUIRED_RESULT QStringList deletedItems() const; private: void davJobFinished(KJob *); Q_DECLARE_PRIVATE(DavItemsListJob) }; } #endif diff --git a/src/common/davjobbase.h b/src/common/davjobbase.h index 803a0b2..12aaec8 100644 --- a/src/common/davjobbase.h +++ b/src/common/davjobbase.h @@ -1,105 +1,105 @@ /* Copyright (c) 2014 Gregory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVJOBBASE_H #define KDAV_DAVJOBBASE_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include #include class DavJobBasePrivate; namespace KDAV { class Error; /** * @short base class for the jobs used by the resource. */ -class KPIMKDAV_EXPORT DavJobBase : public KJob +class KDAV_EXPORT DavJobBase : public KJob { Q_OBJECT public: explicit DavJobBase(QObject *parent = nullptr); ~DavJobBase(); /** * Get the latest response code. * * If no response code has been set then 0 will be returned, but will * be meaningless unless error() is non-zero. In that case this means * that the latest error was not at the HTTP level. */ Q_REQUIRED_RESULT int latestResponseCode() const; /** * Check if the job can be retried later. * * This will return true for transient errors, i.e. if the response code * is either zero and error() is set or if the HTTP response code hints * at a temporary error. * * The HTTP response codes considered retryable are: * - 401 * - 402 * - 407 * - 408 * - 423 * - 429 * - 501 to 504, inclusive * - 507 * - 511 */ Q_REQUIRED_RESULT bool canRetryLater() const; /** * Check if the job failed because of a conflict */ Q_REQUIRED_RESULT bool hasConflict() const; /** * Returns a instance of the KDAV:Error to be able to translate the error */ Q_REQUIRED_RESULT Error davError() const; protected: /** * Sets the latest response code received. * * Only really useful in case of error, though success codes can * also be set. * * @param code The code to set, should be a valid HTTP response code or zero. */ void setLatestResponseCode(int code); void setJobErrorText(const QString &errorText); void setJobError(int jobErrorCode); void setErrorTextFromDavError(); void setDavError(const Error &error); explicit DavJobBase(DavJobBasePrivate *dd, QObject *parent = nullptr); QScopedPointer d_ptr; private: Q_DECLARE_PRIVATE(DavJobBase) }; } #endif diff --git a/src/common/davmultigetprotocol_p.h b/src/common/davmultigetprotocol_p.h index f24d3c3..cc5af14 100644 --- a/src/common/davmultigetprotocol_p.h +++ b/src/common/davmultigetprotocol_p.h @@ -1,55 +1,55 @@ /* Copyright (c) 2010 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVMULTIGETPROTOCOL_H #define KDAV_DAVMULTIGETPROTOCOL_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davprotocolbase_p.h" namespace KDAV { /** * @short Base class for protocols that implement multiget capabilities */ class DavMultigetProtocol : public DavProtocolBase { public: /** * Destroys the DAV protocol */ virtual ~DavMultigetProtocol(); /** * Returns the XML document that represents a MULTIGET DAV query to * list all DAV resources with the given @p urls. */ virtual XMLQueryBuilder::Ptr itemsReportQuery(const QStringList &urls) const = 0; /** * Returns the namespace used by protocol-specific elements found in responses. */ virtual QString responseNamespace() const = 0; /** * Returns the tag name of data elements found in responses. */ virtual QString dataTagName() const = 0; }; } #endif diff --git a/src/common/davprincipalhomesetsfetchjob.h b/src/common/davprincipalhomesetsfetchjob.h index 9027c22..0515b09 100644 --- a/src/common/davprincipalhomesetsfetchjob.h +++ b/src/common/davprincipalhomesetsfetchjob.h @@ -1,79 +1,79 @@ /* Copyright (c) 2010 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVPRINCIPALHOMESETSFETCHJOB_H #define KDAV_DAVPRINCIPALHOMESETSFETCHJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davjobbase.h" #include "davurl.h" #include #include namespace KDAV { class DavPrincipalHomeSetsFetchJobPrivate; /** * @short A job that fetches home sets for a principal. */ -class KPIMKDAV_EXPORT DavPrincipalHomeSetsFetchJob : public DavJobBase +class KDAV_EXPORT DavPrincipalHomeSetsFetchJob : public DavJobBase { Q_OBJECT public: /** * Creates a new dav principals home sets fetch job. * * @param url The DAV url of the DAV principal. * @param parent The parent object. */ explicit DavPrincipalHomeSetsFetchJob(const DavUrl &url, QObject *parent = nullptr); /** * Starts the job. */ void start() override; /** * Returns the found home sets. */ Q_REQUIRED_RESULT QStringList homeSets() const; private: void davJobFinished(KJob *); /** * Start the fetch process. * * There may be two rounds necessary if the first request * does not returns the home sets, but only the current-user-principal * or the principal-URL. The bool flag is here to prevent requesting * those last two on each request, as they are only fetched in * the first round. * * @param fetchHomeSetsOnly If set to true the request will not include * the current-user-principal and principal-URL props. */ void fetchHomeSets(bool fetchHomeSetsOnly); Q_DECLARE_PRIVATE(DavPrincipalHomeSetsFetchJob) }; } #endif diff --git a/src/common/davprincipalsearchjob.h b/src/common/davprincipalsearchjob.h index 94347c7..1d0fa3a 100644 --- a/src/common/davprincipalsearchjob.h +++ b/src/common/davprincipalsearchjob.h @@ -1,109 +1,109 @@ /* Copyright (c) 2011 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVPRINCIPALSEARCHJOB_H #define KDAV_DAVPRINCIPALSEARCHJOB_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davjobbase.h" #include "davurl.h" #include #include #include #include namespace KDAV { class DavPrincipalSearchJobPrivate; /** * @short A job that search a DAV principal on a server * * This job is used to search a principal on a server * that implement the dav-property-search REPORT (RFC3744). * * The properties to fetch are set with @ref fetchProperty(). */ -class KPIMKDAV_EXPORT DavPrincipalSearchJob : public DavJobBase +class KDAV_EXPORT DavPrincipalSearchJob : public DavJobBase { Q_OBJECT public: /** * Types of search that are supported by this job. * DisplayName will match on the DAV displayname property. * EmailAddress will match on the CalDav calendar-user-address-set property. */ enum FilterType { DisplayName, EmailAddress }; /** * Simple struct to hold the search job results */ struct Result { QString propertyNamespace; QString property; QString value; }; /** * Creates a new dav principal search job * * @param url The URL to use in the REPORT query. * @param type The type that the filter will match. * @param filter The filter that will be used to match the displayname attribute. * @param parent The parent object. */ explicit DavPrincipalSearchJob(const DavUrl &url, FilterType type, const QString &filter, QObject *parent = nullptr); /** * Add a new property to fetch from the server. * * @param name The name of the property. * @param ns The namespace of this property, defaults to 'DAV:'. */ void fetchProperty(const QString &name, const QString &ns = QString()); /** * Starts the job */ void start() override; /** * Return the DavUrl used by this job */ Q_REQUIRED_RESULT DavUrl davUrl() const; /** * Get the job results. */ Q_REQUIRED_RESULT QVector results() const; private: void principalCollectionSetSearchFinished(KJob *job); void principalPropertySearchFinished(KJob *job); Q_DECLARE_PRIVATE(DavPrincipalSearchJob) }; } Q_DECLARE_TYPEINFO(KDAV::DavPrincipalSearchJob::Result, Q_MOVABLE_TYPE); #endif diff --git a/src/common/davprotocolbase_p.h b/src/common/davprotocolbase_p.h index 7ff4687..b31df98 100644 --- a/src/common/davprotocolbase_p.h +++ b/src/common/davprotocolbase_p.h @@ -1,134 +1,134 @@ /* Copyright (c) 2009 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVPROTOCOLBASE_H #define KDAV_DAVPROTOCOLBASE_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "davcollection.h" #include #include #include #include namespace KDAV { /** * @short Base class for XML query builders */ class XMLQueryBuilder { public: typedef QSharedPointer Ptr; virtual ~XMLQueryBuilder(); virtual QDomDocument buildQuery() const = 0; virtual QString mimeType() const = 0; void setParameter(const QString &key, const QVariant &value); QVariant parameter(const QString &key) const; private: QMap mParameters; }; /** * @short Base class for various DAV groupware dialects. * * This class provides an interface to query the DAV dialect * specific features and abstract them. * * The functionality is implemented in: * @li CaldavProtocol * @li CarddavProtocol * @li GroupdavProtocol */ class DavProtocolBase { public: /** * Destroys the dav protocol base. */ virtual ~DavProtocolBase(); /** * Returns whether the dav protocol dialect supports principal * queries. If true, it must return the home set it provides * access to with principalHomeSet() and the home set namespace * with principalHomeSetNS(); */ virtual bool supportsPrincipals() const = 0; /** * Returns whether the dav protocol dialect supports the REPORT * command to query all resources of a collection. * If not, PROPFIND command will be used instead. */ virtual bool useReport() const = 0; /** * Returns whether the dav protocol dialect supports the MULTIGET command. * * If MULTIGET is supported, the content of all dav resources * can be fetched in ResourceBase::retrieveItems() already and * there is no need to call ResourceBase::retrieveItem() for every single * dav resource. * * Protocols that have MULTIGET capabilities must inherit from * DavMultigetProtocol instead of this class. */ virtual bool useMultiget() const = 0; /** * Returns the home set that this protocol supports. */ virtual QString principalHomeSet() const; /** * Returns the namespace of the home set. */ virtual QString principalHomeSetNS() const; /** * Returns the XML document that represents the DAV query to * list all available DAV collections. */ virtual XMLQueryBuilder::Ptr collectionsQuery() const = 0; /** * Returns the XQuery string that filters out the relevant XML elements * from the result returned by the query that is provided by collectionQuery(). */ virtual QString collectionsXQuery() const = 0; /** * Returns a list of XML documents that represent DAV queries to * list all available DAV resources inside a specific DAV collection. */ virtual QVector itemsQueries() const = 0; /** * Returns the possible content types for the collection that * is described by the passed @p propstat element of a PROPFIND result. */ virtual DavCollection::ContentTypes collectionContentTypes(const QDomElement &propstat) const = 0; }; } #endif diff --git a/src/common/davurl.h b/src/common/davurl.h index 05bb022..a15bf67 100644 --- a/src/common/davurl.h +++ b/src/common/davurl.h @@ -1,93 +1,93 @@ /* Copyright (c) 2010 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_DAVURL_H #define KDAV_DAVURL_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "enums.h" #include #include #include namespace KDAV { class DavUrlPrivate; /** * @short A helper class to combine url and protocol of a DAV url. */ -class KPIMKDAV_EXPORT DavUrl +class KDAV_EXPORT DavUrl { public: /** * Defines a list of DAV url objects. */ typedef QVector List; /** * Creates an empty DAV url. */ DavUrl(); DavUrl(const DavUrl&); ~DavUrl(); DavUrl& operator=(const DavUrl&); /** * Creates a new DAV url. * * @param url The url that identifies the DAV object. * @param protocol The DAV protocol dialect that is used to retrieve the DAV object. */ DavUrl(const QUrl &url, Protocol protocol); /** * Sets the @p url that identifies the DAV object. */ void setUrl(const QUrl &url); /** * Returns the url that identifies the DAV object. */ Q_REQUIRED_RESULT QUrl url() const; /** * Returns the url in a user-friendly way without login information. */ Q_REQUIRED_RESULT QString toDisplayString() const; /** * Sets the DAV @p protocol dialect that is used to retrieve the DAV object. */ void setProtocol(Protocol protocol); /** * Returns the DAV protocol dialect that is used to retrieve the DAV object. */ Q_REQUIRED_RESULT Protocol protocol() const; private: QSharedDataPointer d; }; -KPIMKDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavUrl &url); -KPIMKDAV_EXPORT QDataStream &operator>>(QDataStream &in, DavUrl &url); +KDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavUrl &url); +KDAV_EXPORT QDataStream &operator>>(QDataStream &in, DavUrl &url); } Q_DECLARE_TYPEINFO(KDAV::DavUrl, Q_MOVABLE_TYPE); #endif diff --git a/src/common/etagcache.h b/src/common/etagcache.h index 4cc9c9f..7fdb117 100644 --- a/src/common/etagcache.h +++ b/src/common/etagcache.h @@ -1,106 +1,106 @@ /* Copyright (c) 2010 Grégory Oestreicher This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_ETAGCACHE_H #define KDAV_ETAGCACHE_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include #include #include namespace KDAV { class EtagCachePrivate; /** * @short A helper class to cache etags. * * The EtagCache caches the remote ids and etags of all items * in a given collection. This cache is needed to find * out which items have been changed in the backend and have to * be refetched on the next call of ResourceBase::retrieveItems() */ -class KPIMKDAV_EXPORT EtagCache : public QObject +class KDAV_EXPORT EtagCache : public QObject { Q_OBJECT public: /** * Creates a new etag cache and populates it with the ETags * of items found in @p collection. */ explicit EtagCache(QObject *parent = nullptr); ~EtagCache(); /** * Sets the ETag for the remote ID. If the remote ID is marked as * changed (is contained in the return of changedRemoteIds), remove * it from the changed list. */ void setEtag(const QString &remoteId, const QString &etag); /** * Checks if the given item is in the cache */ Q_REQUIRED_RESULT bool contains(const QString &remoteId) const; /** * Check if the known ETag for the remote ID is equal to @p refEtag. */ Q_REQUIRED_RESULT bool etagChanged(const QString &remoteId, const QString &refEtag) const; /** * Mark an item as changed in the backend. */ void markAsChanged(const QString &remoteId); /** * Returns true if the remote ID is marked as changed (is contained in the * return of changedRemoteIds) */ Q_REQUIRED_RESULT bool isOutOfDate(const QString &remoteId) const; /** * Removes the entry for item with remote ID @p remoteId. */ void removeEtag(const QString &remoteId); /** * Returns the list of all items URLs. */ Q_REQUIRED_RESULT QStringList urls() const; /** * Returns the list of remote ids of items that have been changed * in the backend. */ Q_REQUIRED_RESULT QStringList changedRemoteIds() const; protected: /** * Sets the ETag for the remote ID. */ void setEtagInternal(const QString &remoteId, const QString &etag); private: const std::unique_ptr d; }; } #endif diff --git a/src/common/protocolinfo.h b/src/common/protocolinfo.h index 160fb90..d84ba7e 100644 --- a/src/common/protocolinfo.h +++ b/src/common/protocolinfo.h @@ -1,67 +1,67 @@ /* Copyright (c) 2019 Volker Krause This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KDAV_PROTOCOLINFO_H #define KDAV_PROTOCOLINFO_H -#include "kpimkdav_export.h" +#include "kdav_export.h" #include "enums.h" class QLatin1String; namespace KDAV { /** Information about a DAV protocol. */ namespace ProtocolInfo { /** * Returns whether the @p protocol dialect supports the MULTIGET command. * * If MULTIGET is supported, the content of all dav resources * can be fetched in ResourceBase::retrieveItems() already and * there is no need to call ResourceBase::retrieveItem() for every single * dav resource. */ - KPIMKDAV_EXPORT Q_REQUIRED_RESULT bool useMultiget(KDAV::Protocol protocol); + KDAV_EXPORT Q_REQUIRED_RESULT bool useMultiget(KDAV::Protocol protocol); /** Returns the principal home set of @p protocol. */ - KPIMKDAV_EXPORT Q_REQUIRED_RESULT QString principalHomeSet(KDAV::Protocol protocol); + KDAV_EXPORT Q_REQUIRED_RESULT QString principalHomeSet(KDAV::Protocol protocol); /** Returns the principal home set namespace of @p protocol. */ - KPIMKDAV_EXPORT Q_REQUIRED_RESULT QString principalHomeSetNS(KDAV::Protocol protocol); + KDAV_EXPORT Q_REQUIRED_RESULT QString principalHomeSetNS(KDAV::Protocol protocol); /** * Returns the untranslated name of the given DAV @p protocol dialect. */ - KPIMKDAV_EXPORT Q_REQUIRED_RESULT QLatin1String protocolName(KDAV::Protocol protocol); + KDAV_EXPORT Q_REQUIRED_RESULT QLatin1String protocolName(KDAV::Protocol protocol); /** * Returns the protocol matching the given name. This is the opposite of * Utils::protocolName(). */ - KPIMKDAV_EXPORT Q_REQUIRED_RESULT KDAV::Protocol protocolByName(const QString &name); + KDAV_EXPORT Q_REQUIRED_RESULT KDAV::Protocol protocolByName(const QString &name); /** * Returns the mimetype that shall be used for contact DAV resources using @p protocol. */ - KPIMKDAV_EXPORT Q_REQUIRED_RESULT QString contactsMimeType(KDAV::Protocol protocol); + KDAV_EXPORT Q_REQUIRED_RESULT QString contactsMimeType(KDAV::Protocol protocol); } } #endif // KDAV_PROTOCOLINFO_H diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d91c4f7..e1316ff 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,15 +1,15 @@ kde_enable_exceptions() set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) set(testserver_SRCS testserver.cpp ) add_executable(testserver ${testserver_SRCS}) target_link_libraries(testserver Qt5::Core - KPim::KDAV + KF5::DAV Qt5::Xml )