summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2015-04-20 16:42:13 +0200
committerChristian Mollekopf <mollekopf@kolabsys.com>2015-04-28 16:15:00 +0200
commit26cd390db4e64b33556cbde97053a52be13b2f13 (patch)
tree5a698c1899da493550a2237547b5fc747791dfde
parent225d9c80075acc7ee3ae72ebfd19398cc1499796 (diff)
downloadlibkolab-26cd390db4e64b33556cbde97053a52be13b2f13.tar.gz
Ported to KF5
-rw-r--r--CMakeLists.txt132
-rw-r--r--calendaring/calendaring.cpp5
-rw-r--r--conversion/kabcconversion.cpp120
-rw-r--r--conversion/kabcconversion.h12
-rw-r--r--conversion/kcalconversion.cpp5
-rw-r--r--conversion/kolabconversion.cpp13
-rw-r--r--freebusy/freebusy.cpp4
-rw-r--r--icalendar/imip.cpp10
-rw-r--r--kolabformat/errorhandler.h2
-rw-r--r--kolabformat/kolabobject.cpp39
-rw-r--r--kolabformat/kolabobject.h32
-rw-r--r--kolabformat/mimeobject.cpp8
-rw-r--r--kolabformat/v2helpers.cpp18
-rw-r--r--kolabformat/v2helpers.h8
-rw-r--r--kolabformat/xmlobject.cpp8
-rw-r--r--kolabformatV2/contact.cpp144
-rw-r--r--kolabformatV2/contact.h14
-rw-r--r--kolabformatV2/distributionlist.cpp18
-rw-r--r--kolabformatV2/distributionlist.h8
-rw-r--r--kolabformatV2/event.cpp2
-rw-r--r--kolabformatV2/kolabbase.cpp24
-rw-r--r--kolabformatV2/kolabbase.h10
-rw-r--r--kolabformatV2/note.cpp6
-rw-r--r--kolabformatV2/task.cpp4
-rw-r--r--libkolab_config.h.in6
-rw-r--r--mime/mimeutils.cpp6
-rw-r--r--mime/mimeutils.h4
-rw-r--r--tests/CMakeLists.txt4
-rw-r--r--tests/formattest.cpp34
-rw-r--r--tests/formattest.h2
-rw-r--r--tests/kcalconversiontest.cpp14
-rw-r--r--tests/testhelpers.h10
-rw-r--r--tests/testutils.h36
-rw-r--r--tests/upgradetest.cpp8
34 files changed, 357 insertions, 413 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 365edac..3f6d90a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,10 @@
project(Libkolab)
-cmake_minimum_required(VERSION 2.6.4)
+cmake_minimum_required(VERSION 2.8.9)
-option( BUILD_TESTS "Build the tests" TRUE )
-option( PYTHON_BINDINGS "Build bindings for python" FALSE )
-option( PHP_BINDINGS "Build bindings for php" FALSE )
-option( USE_LIBCALENDARING "Use libcalendaring" FALSE )
+option(BUILD_TESTS "Build the tests" TRUE)
+option(PYTHON_BINDINGS "Build bindings for python" FALSE)
+option(PHP_BINDINGS "Build bindings for php" FALSE)
set(Libkolab_MODULE_DIR ${Libkolab_SOURCE_DIR}/cmake/modules)
set(CMAKE_MODULE_PATH ${Libkolab_MODULE_DIR})
@@ -30,19 +29,19 @@ endif()
# 0.1.0 (first release)
# 0.1.1 (patch release for 0.1.0)
# 0.2 (0.2 development version towards 0.2.0)
-set(Libkolab_VERSION_MAJOR 0)
-set(Libkolab_VERSION_MINOR 7)
+set(Libkolab_VERSION_MAJOR 1)
+set(Libkolab_VERSION_MINOR 0)
# Enable the full x.y.z version only for release versions
#set(Libkolab_VERSION_PATCH 1)
-#set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR}.${Libkolab_VERSION_PATCH} )
-set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR} )
+#set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR}.${Libkolab_VERSION_PATCH})
+set(Libkolab_VERSION ${Libkolab_VERSION_MAJOR}.${Libkolab_VERSION_MINOR})
set(Libkolab_VERSION_STRING ${CMAKE_PROJECT_NAME}-${Libkolab_VERSION})
# set up install directories.
set(LIB_INSTALL_DIR lib${LIB_SUFFIX} CACHE STRING "The directories where to install libraries to")
set(INCLUDE_INSTALL_DIR include CACHE STRING "The directory where to install headers to")
set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR}/kolab)
-set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/Libkolab )
+set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/Libkolab)
# Make relative paths absolute (needed later on)
foreach(p LIB INCLUDE CMAKECONFIG)
@@ -54,60 +53,64 @@ endforeach()
include(MacroLogFeature)
+find_package(Qt5Core REQUIRED)
+
+
# Do the building
find_package(Libkolabxml 1.1 REQUIRED)
macro_log_feature(Libkolabxml_FOUND "Libkolabxml" "Kolab XML Format 3 serializing library" "http://git.kolab.org/libkolabxml/" TRUE "1.0" "Required for reading/writing Kolab XML Objects")
-find_package(Qt4 4.6.0 REQUIRED)
+find_package(ECM 5.9.0 CONFIG REQUIRED)
+set(CMAKE_MODULE_PATH "${Libkolab_SOURCE_DIR}/cmake/modules/" ${ECM_MODULE_PATH})
+include(GenerateExportHeader)
+include(ECMGenerateHeaders)
+include(ECMGeneratePriFile)
+include(ECMPackageConfigHelpers)
+include(ECMSetupVersion)
+include(FeatureSummary)
+
+set(QT_REQUIRED_VERSION "5.2.0")
-if (USE_LIBCALENDARING)
- find_package(Libcalendaring)
- macro_log_feature(LIBCALENDARING_FOUND "Libcalendaring" "KDE Calendaring-Dependencies Library" "http://git.kolab.org/libcalendaring/" TRUE "" "Required if KDE libraries are not available.")
-else()
- find_package(KDE4 4.8 REQUIRED)
- find_package(KdepimLibs 4.8 REQUIRED)
+if (Qt5_POSITION_INDEPENDENT_CODE)
+ #Requires cmake 2.8.9 (same as -fPIC on gcc)
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
+set(KDEPIMLIBS_LIB_VERSION "4.71.0")
+find_package(KF5Akonadi ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
+find_package(KF5Contacts ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
+find_package(KF5CalendarUtils ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
+find_package(KF5Mime ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
+find_package(KF5AkonadiNotes ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
+
find_package(SWIG)
#Show summary of found libraries
macro_display_feature_log()
-# add_definitions( -DKDEPIMLIBS_VERSION=((${KdepimLibs_VERSION_MAJOR}<<16)|(${KdepimLibs_VERSION_MINOR}<<8)|(${KDEPIMLIBS_VERSION_PATCH})) )
-add_definitions( -DKDEPIMLIBS_VERSION_MAJOR=${KdepimLibs_VERSION_MAJOR} )
-add_definitions( -DKDEPIMLIBS_VERSION_MINOR=${KdepimLibs_VERSION_MINOR} )
-add_definitions( -DKDEPIMLIBS_VERSION_PATCH=${KdepimLibs_VERSION_PATCH} )
-
-if("${KdepimLibs_VERSION}" VERSION_GREATER "4.8.40" OR USE_LIBCALENDARING)
- add_definitions(-DKDEPIMLIBS_VERSION_DEVEL)
-endif()
+# add_definitions(-DKDEPIMLIBS_VERSION=((${KdepimLibs_VERSION_MAJOR}<<16)|(${KdepimLibs_VERSION_MINOR}<<8)|(${KDEPIMLIBS_VERSION_PATCH})))
+add_definitions(-DKDEPIMLIBS_VERSION_MAJOR=${KdepimLibs_VERSION_MAJOR})
+add_definitions(-DKDEPIMLIBS_VERSION_MINOR=${KdepimLibs_VERSION_MINOR})
+add_definitions(-DKDEPIMLIBS_VERSION_PATCH=${KdepimLibs_VERSION_PATCH})
-set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -fexceptions -UQT_NO_EXCEPTIONS -fPIC -g" )
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -fexceptions -UQT_NO_EXCEPTIONS -fPIC -g -std=c++11")
# message("${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG")
-if (USE_LIBCALENDARING)
- set( KDE_INCLUDES ${Libcalendaring_INCLUDE_DIRS} )
- set( KDE_LIBRARIES ${Libcalendaring_LIBRARIES} )
- message("${Libcalendaring_INCLUDE_DIRS} ${Libcalendaring_LIBRARIES}")
-else()
- set( KDE_INCLUDES ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} )
- set( KDE_LIBRARIES
- ${KDEPIMLIBS_KCALCORE_LIBS}
- ${KDEPIMLIBS_KABC_LIBS}
- ${KDEPIMLIBS_KMIME_LIBS}
- ${KDEPIMLIBS_AKONADI_LIBS}
- ${KDEPIMLIBS_AKONADI_NOTES_LIBS}
- ${KDEPIMLIBS_KCALUTILS_LIBS}
- ${KDEPIMLIBS_KPIMUTILS_LIBS}
- ${KDE4_KDECORE_LIBRARY}
- ${KDE4_KIO_LIBRARY}
- )
-endif()
+set(KDE_INCLUDES ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES})
+set(KDE_LIBRARIES
+ KF5::CalendarCore
+ KF5::Contacts
+ KF5::Mime
+ KF5::AkonadiCore
+ KF5::AkonadiNotes
+ KF5::CalendarUtils
+ KF5::KIOCore
+)
find_package(Boost REQUIRED)
-include_directories(
+include_directories(
${QT_INCLUDES}
${KDE_INCLUDES}
${CMAKE_BINARY_DIR}
@@ -119,17 +122,6 @@ include_directories(
configure_file(libkolab-version.h.cmake "${CMAKE_BINARY_DIR}/libkolab-version.h" @ONLY)
-set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS})
-set(CMAKE_REQUIRED_INCLUDES "/opt/devel/kolab/include/")
-# include(CheckIncludeFileCXX)
-# check_include_file_cxx(akonadi/tag.h HAVE_TAG_H)
-#check_include_file_cxx doesn't work for some reason, so we use find_path instead.
-#we have to make sure that we only search in KDE_INCLUDES though, to not accidentally include a system akonadi/tag.h
-#when we're searching for one in libcalendaring.
-find_path(HAVE_TAG_H akonadi/tag.h PATHS ${KDE_INCLUDES} NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH)
-find_path(HAVE_RELATION_H akonadi/relation.h PATHS ${KDE_INCLUDES} NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libkolab_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/libkolab_config.h)
-
add_subdirectory(kolabformatV2)
add_subdirectory(conversion)
add_subdirectory(calendaring)
@@ -137,8 +129,8 @@ add_subdirectory(icalendar)
add_subdirectory(freebusy)
add_subdirectory(utils)
-QT4_WRAP_CPP(CALENDARING_MOC calendaring/event.h)
-# QT4_WRAP_CPP(CONVERSION_MOC conversion/qtevent.h conversion/qtduration.h)
+QT5_WRAP_CPP(CALENDARING_MOC calendaring/event.h)
+# QT5_WRAP_CPP(CONVERSION_MOC conversion/qtevent.h conversion/qtduration.h)
set(KOLAB_SRCS
kolabformat/kolabobject.cpp
@@ -159,25 +151,28 @@ set(KOLAB_SRCS
set(KOLAB_LINK_LIBRARIES
${Libkolabxml_LIBRARIES}
- ${QT_QTCORE_LIBRARY}
- ${QT_QTXML_LIBRARY}
- ${QT_QTGUI_LIBRARY}
${KDE_LIBRARIES}
+ Qt5::Core
+ Qt5::Xml
+ Qt5::Gui
+ Qt5::Widgets
)
+
if(BUILD_TESTS)
+ find_package(Qt5Test REQUIRED)
#for tests only
enable_testing()
add_library(kolab_static STATIC ${KOLAB_SRCS})
- target_link_libraries(kolab_static ${KOLAB_LINK_LIBRARIES})
+ target_link_libraries(kolab_static ${KOLAB_LINK_LIBRARIES} Qt5::Test)
add_subdirectory(tests)
endif(BUILD_TESTS)
add_library(kolab SHARED ${KOLAB_SRCS})
target_link_libraries(kolab ${KOLAB_LINK_LIBRARIES})
set_target_properties(kolab PROPERTIES VERSION ${Libkolab_VERSION}
- SOVERSION ${Libkolab_VERSION_MAJOR} )
+ SOVERSION ${Libkolab_VERSION_MAJOR})
-install(TARGETS kolab EXPORT LibkolabExport
+install(TARGETS kolab EXPORT LibkolabExport
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
@@ -191,7 +186,6 @@ install(FILES
kolabformat/errorhandler.h
kolabformat/xmlobject.h
kolabformat/mimeobject.h
- ${CMAKE_CURRENT_BINARY_DIR}/libkolab_config.h
conversion/kcalconversion.h
conversion/kabcconversion.h
conversion/commonconversion.h
@@ -204,13 +198,13 @@ file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKECONFIG_INSTALL_DIR}" "${INCLUDE_INSTA
#Assemble the full relative path. This will be used in the LibkolabConfig.cmake, which will be installed in CMAKECONFIG_INSTALL_DIR
set(CONF_INCLUDE_DIRS "\${Libkolab_CMAKE_DIR}/${REL_INCLUDE_DIR}")
-install(EXPORT LibkolabExport DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE LibkolabTargets.cmake )
+install(EXPORT LibkolabExport DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE LibkolabTargets.cmake)
-configure_file(${Libkolab_MODULE_DIR}/LibkolabConfig.cmake.in ${Libkolab_BINARY_DIR}/LibkolabConfig.cmake @ONLY )
-configure_file(${Libkolab_MODULE_DIR}/LibkolabConfigVersion.cmake.in ${Libkolab_BINARY_DIR}/LibkolabConfigVersion.cmake @ONLY )
+configure_file(${Libkolab_MODULE_DIR}/LibkolabConfig.cmake.in ${Libkolab_BINARY_DIR}/LibkolabConfig.cmake @ONLY)
+configure_file(${Libkolab_MODULE_DIR}/LibkolabConfigVersion.cmake.in ${Libkolab_BINARY_DIR}/LibkolabConfigVersion.cmake @ONLY)
# Install these two files into the same directory as the generated exports-file.
install(FILES ${Libkolab_BINARY_DIR}/LibkolabConfig.cmake ${Libkolab_BINARY_DIR}/LibkolabConfigVersion.cmake
- DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
+ DESTINATION ${CMAKECONFIG_INSTALL_DIR})
include(SWIGUtils)
diff --git a/calendaring/calendaring.cpp b/calendaring/calendaring.cpp
index 204353c..8128ca0 100644
--- a/calendaring/calendaring.cpp
+++ b/calendaring/calendaring.cpp
@@ -19,8 +19,9 @@
#include <kcalcore/event.h>
#include <kcalcore/todo.h>
-#include <Qt/qdebug.h>
+#include <qdebug.h>
#include <kolabevent.h>
+#include <QDate>
#include "conversion/kcalconversion.h"
#include "conversion/commonconversion.h"
@@ -114,4 +115,4 @@ std::vector<Kolab::Event> Calendar::getEvents(const Kolab::cDateTime& start, con
} //Namespace
-} //Namespace \ No newline at end of file
+} //Namespace
diff --git a/conversion/kabcconversion.cpp b/conversion/kabcconversion.cpp
index 76d9597..64d8311 100644
--- a/conversion/kabcconversion.cpp
+++ b/conversion/kabcconversion.cpp
@@ -188,41 +188,41 @@ namespace Kolab {
int fromAddressType(int kabcType, bool &pref)
{
int type = 0;
- if (kabcType & KABC::Address::Dom) {
+ if (kabcType & KContacts::Address::Dom) {
Warning() << "domestic address is not supported";
}
- if (kabcType & KABC::Address::Intl) {
+ if (kabcType & KContacts::Address::Intl) {
Warning() << "international address is not supported";
}
- if (kabcType & KABC::Address::Pref) {
+ if (kabcType & KContacts::Address::Pref) {
pref = true;
}
- if (kabcType & KABC::Address::Postal) {
+ if (kabcType & KContacts::Address::Postal) {
Warning() << "postal address is not supported";
}
- if (kabcType & KABC::Address::Parcel) {
+ if (kabcType & KContacts::Address::Parcel) {
Warning() << "parcel is not supported";
}
- if (kabcType & KABC::Address::Home) {
+ if (kabcType & KContacts::Address::Home) {
type |= Kolab::Address::Home;
}
- if (kabcType & KABC::Address::Work) {
+ if (kabcType & KContacts::Address::Work) {
type |= Kolab::Address::Work;
}
return type;
}
-KABC::Address::Type toAddressType(int types, bool pref)
+KContacts::Address::Type toAddressType(int types, bool pref)
{
- KABC::Address::Type type = 0;
+ KContacts::Address::Type type = 0;
if (pref) {
- type |= KABC::Address::Pref;
+ type |= KContacts::Address::Pref;
}
if (types & Kolab::Address::Home) {
- type |= KABC::Address::Home;
+ type |= KContacts::Address::Home;
}
if (types & Kolab::Address::Work) {
- type |= KABC::Address::Work;
+ type |= KContacts::Address::Work;
}
return type;
}
@@ -230,91 +230,91 @@ KABC::Address::Type toAddressType(int types, bool pref)
int fromPhoneType(int kabcType, bool &pref)
{
int type = 0;
- if (kabcType & KABC::PhoneNumber::Home) {
+ if (kabcType & KContacts::PhoneNumber::Home) {
type |= Kolab::Telephone::Home;
}
- if (kabcType & KABC::PhoneNumber::Work) {
+ if (kabcType & KContacts::PhoneNumber::Work) {
type |= Kolab::Telephone::Work;
}
- if (kabcType & KABC::PhoneNumber::Msg) {
+ if (kabcType & KContacts::PhoneNumber::Msg) {
type |= Kolab::Telephone::Text;
}
- if (kabcType & KABC::PhoneNumber::Pref) {
+ if (kabcType & KContacts::PhoneNumber::Pref) {
pref = true;
}
- if (kabcType & KABC::PhoneNumber::Voice) {
+ if (kabcType & KContacts::PhoneNumber::Voice) {
type |= Kolab::Telephone::Voice;
}
- if (kabcType & KABC::PhoneNumber::Fax) {
+ if (kabcType & KContacts::PhoneNumber::Fax) {
type |= Kolab::Telephone::Fax;
}
- if (kabcType & KABC::PhoneNumber::Cell) {
+ if (kabcType & KContacts::PhoneNumber::Cell) {
type |= Kolab::Telephone::Cell;
}
- if (kabcType & KABC::PhoneNumber::Video) {
+ if (kabcType & KContacts::PhoneNumber::Video) {
type |= Kolab::Telephone::Video;
}
- if (kabcType & KABC::PhoneNumber::Bbs) {
+ if (kabcType & KContacts::PhoneNumber::Bbs) {
Warning() << "mailbox number is not supported";
}
- if (kabcType & KABC::PhoneNumber::Modem) {
+ if (kabcType & KContacts::PhoneNumber::Modem) {
Warning() << "modem is not supported";
}
- if (kabcType & KABC::PhoneNumber::Car) {
+ if (kabcType & KContacts::PhoneNumber::Car) {
type |= Kolab::Telephone::Car;
}
- if (kabcType & KABC::PhoneNumber::Isdn) {
+ if (kabcType & KContacts::PhoneNumber::Isdn) {
Warning() << "isdn number is not supported";
}
- if (kabcType & KABC::PhoneNumber::Pcs) {
+ if (kabcType & KContacts::PhoneNumber::Pcs) {
type |= Kolab::Telephone::Text;
}
- if (kabcType & KABC::PhoneNumber::Pager) {
+ if (kabcType & KContacts::PhoneNumber::Pager) {
type |= Kolab::Telephone::Pager;
}
return type;
}
-KABC::PhoneNumber::Type toPhoneType(int types, bool pref)
+KContacts::PhoneNumber::Type toPhoneType(int types, bool pref)
{
- KABC::PhoneNumber::Type type = 0;
+ KContacts::PhoneNumber::Type type = 0;
if (types & Kolab::Telephone::Home) {
- type |= KABC::PhoneNumber::Home;
+ type |= KContacts::PhoneNumber::Home;
}
if (types & Kolab::Telephone::Work) {
- type |= KABC::PhoneNumber::Work;
+ type |= KContacts::PhoneNumber::Work;
}
if (types & Kolab::Telephone::Text) {
- type |= KABC::PhoneNumber::Msg;
+ type |= KContacts::PhoneNumber::Msg;
}
if (pref) {
- type |= KABC::PhoneNumber::Pref;
+ type |= KContacts::PhoneNumber::Pref;
}
if (types & Kolab::Telephone::Voice) {
- type |= KABC::PhoneNumber::Voice;
+ type |= KContacts::PhoneNumber::Voice;
}
if (types & Kolab::Telephone::Fax) {
- type |= KABC::PhoneNumber::Fax;
+ type |= KContacts::PhoneNumber::Fax;
}
if (types & Kolab::Telephone::Cell) {
- type |= KABC::PhoneNumber::Cell;
+ type |= KContacts::PhoneNumber::Cell;
}
if (types & Kolab::Telephone::Video) {
- type |= KABC::PhoneNumber::Video;
+ type |= KContacts::PhoneNumber::Video;
}
if (types & Kolab::Telephone::Car) {
- type |= KABC::PhoneNumber::Car;
+ type |= KContacts::PhoneNumber::Car;
}
if (types & Kolab::Telephone::Text) {
- type |= KABC::PhoneNumber::Pcs;
+ type |= KContacts::PhoneNumber::Pcs;
}
if (types & Kolab::Telephone::Pager) {
- type |= KABC::PhoneNumber::Pager;
+ type |= KContacts::PhoneNumber::Pager;
}
return type;
}
-std::string fromPicture(const KABC::Picture &pic, std::string &mimetype)
+std::string fromPicture(const KContacts::Picture &pic, std::string &mimetype)
{
QByteArray input;
QBuffer buffer( &input );
@@ -355,7 +355,7 @@ std::string fromPicture(const KABC::Picture &pic, std::string &mimetype)
return std::string(input.data(), input.size());
}
-KABC::Picture toPicture(const std::string &data, const std::string &mimetype) {
+KContacts::Picture toPicture(const std::string &data, const std::string &mimetype) {
QImage img;
bool ret = false;
QByteArray type(mimetype.data(), mimetype.size());
@@ -367,13 +367,13 @@ KABC::Picture toPicture(const std::string &data, const std::string &mimetype) {
}
if (!ret) {
Warning() << "failed to load picture";
- return KABC::Picture();
+ return KContacts::Picture();
}
- KABC::Picture logo(img);
+ KContacts::Picture logo(img);
if (logo.isEmpty()) {
Warning() << "failed to read picture";
- return KABC::Picture();
+ return KContacts::Picture();
}
return logo;
}
@@ -420,9 +420,9 @@ static int emailTypesFromStringlist(const QString &types) {
return emailTypes;
}
-KABC::Addressee toKABC(const Kolab::Contact &contact)
+KContacts::Addressee toKABC(const Kolab::Contact &contact)
{
- KABC::Addressee addressee;
+ KContacts::Addressee addressee;
addressee.setUid(fromStdString(contact.uid()));
addressee.setCategories(toStringList(contact.categories()));
//addressee.setName(fromStdString(contact.name()));//This one is only for compatiblity (and results in a non-existing name property)
@@ -447,7 +447,7 @@ KABC::Addressee toKABC(const Kolab::Contact &contact)
addressee.setNote(fromStdString(contact.note()));
- addressee.setSecrecy(KABC::Secrecy::Public); //We don't have any privacy setting in xCard
+ addressee.setSecrecy(KContacts::Secrecy::Public); //We don't have any privacy setting in xCard
QString preferredEmail;
@@ -489,7 +489,7 @@ KABC::Addressee toKABC(const Kolab::Contact &contact)
addressee.setTitle(fromStdString(contact.titles().at(0))); //TODO support multiple
}
if (!contact.urls().empty()) {
- addressee.setUrl(fromStdString(contact.urls().at(0).url())); //TODO support multiple
+ addressee.setUrl(QUrl(fromStdString(contact.urls().at(0).url()))); //TODO support multiple
foreach(const Kolab::Url &u, contact.urls()) {
if (u.type() == Kolab::Url::Blog) {
addressee.insertCustom("KADDRESSBOOK", "BlogFeed", fromStdString(u.url()));
@@ -550,7 +550,7 @@ KABC::Addressee toKABC(const Kolab::Contact &contact)
if (index == contact.telephonesPreferredIndex()) {
pref = true;
}
- KABC::PhoneNumber number(fromStdString(tel.number()), toPhoneType(tel.types(), pref));
+ KContacts::PhoneNumber number(fromStdString(tel.number()), toPhoneType(tel.types(), pref));
index++;
addressee.insertPhoneNumber(number);
}
@@ -563,7 +563,7 @@ KABC::Addressee toKABC(const Kolab::Contact &contact)
if (index == contact.addressPreferredIndex()) {
pref = true;
}
- KABC::Address adr(toAddressType(a.types(), pref));
+ KContacts::Address adr(toAddressType(a.types(), pref));
adr.setLabel(fromStdString(a.label()));
adr.setStreet(fromStdString(a.street()));
adr.setLocality(fromStdString(a.locality()));
@@ -602,7 +602,7 @@ KABC::Addressee toKABC(const Kolab::Contact &contact)
return addressee;
}
-Kolab::Contact fromKABC(const KABC::Addressee &addressee)
+Kolab::Contact fromKABC(const KContacts::Addressee &addressee)
{
int prefNum = -1;
int prefCounter = -1;
@@ -677,7 +677,7 @@ Kolab::Contact fromKABC(const KABC::Addressee &addressee)
std::vector<Kolab::Address> addresses;
prefNum = -1;
prefCounter = -1;
- foreach(const KABC::Address &a, addressee.addresses()) {
+ foreach(const KContacts::Address &a, addressee.addresses()) {
Kolab::Address adr;
bool pref = false;
adr.setTypes(fromAddressType(a.type(), pref));
@@ -717,7 +717,7 @@ Kolab::Contact fromKABC(const KABC::Addressee &addressee)
std::vector <Kolab::Telephone> phones;
prefNum = -1;
prefCounter = -1;
- foreach (const KABC::PhoneNumber &n, addressee.phoneNumbers()) {
+ foreach (const KContacts::PhoneNumber &n, addressee.phoneNumbers()) {
Kolab::Telephone p;
p.setNumber(toStdString(n.number()));
bool pref = false;
@@ -844,7 +844,7 @@ Kolab::Contact fromKABC(const KABC::Addressee &addressee)
return c;
}
-DistList fromKABC(const KABC::ContactGroup &cg)
+DistList fromKABC(const KContacts::ContactGroup &cg)
{
DistList dl;
dl.setName(toStdString(cg.name()));
@@ -852,11 +852,11 @@ DistList fromKABC(const KABC::ContactGroup &cg)
std::vector <Kolab::ContactReference > members;
for (unsigned int i = 0; i < cg.dataCount(); i++) {
- const KABC::ContactGroup::Data &data = cg.data(i);
+ const KContacts::ContactGroup::Data &data = cg.data(i);
members.push_back(Kolab::ContactReference(Kolab::ContactReference::EmailReference, toStdString(data.email()), toStdString(data.name())));
}
for (unsigned int i = 0; i < cg.contactReferenceCount(); i++) {
- const KABC::ContactGroup::ContactReference &ref = cg.contactReference(i);
+ const KContacts::ContactGroup::ContactReference &ref = cg.contactReference(i);
members.push_back(Kolab::ContactReference(Kolab::ContactReference::UidReference, toStdString(ref.uid())));
}
@@ -869,17 +869,17 @@ DistList fromKABC(const KABC::ContactGroup &cg)
return dl;
}
-KABC::ContactGroup toKABC(const DistList &dl)
+KContacts::ContactGroup toKABC(const DistList &dl)
{
- KABC::ContactGroup cg(fromStdString(dl.name()));
+ KContacts::ContactGroup cg(fromStdString(dl.name()));
cg.setId(fromStdString(dl.uid()));
foreach(const Kolab::ContactReference &m, dl.members()) {
switch (m.type()) {
case Kolab::ContactReference::EmailReference:
- cg.append(KABC::ContactGroup::Data(fromStdString(m.name()), fromStdString(m.email())));
+ cg.append(KContacts::ContactGroup::Data(fromStdString(m.name()), fromStdString(m.email())));
break;
case Kolab::ContactReference::UidReference:
- cg.append(KABC::ContactGroup::ContactReference(fromStdString(m.uid())));
+ cg.append(KContacts::ContactGroup::ContactReference(fromStdString(m.uid())));
break;
default:
Error() << "invalid contact reference";
diff --git a/conversion/kabcconversion.h b/conversion/kabcconversion.h
index 0b7863a..648006b 100644
--- a/conversion/kabcconversion.h
+++ b/conversion/kabcconversion.h
@@ -21,8 +21,8 @@
#include "kolab_export.h"
#include <kolabcontact.h>
-#include <kabc/addressee.h>
-#include <kabc/contactgroup.h>
+#include <kcontacts/addressee.h>
+#include <kcontacts/contactgroup.h>
namespace Kolab {
/**
@@ -31,11 +31,11 @@ namespace Kolab {
*/
namespace Conversion {
- KOLAB_EXPORT KABC::Addressee toKABC(const Kolab::Contact &);
- KOLAB_EXPORT Kolab::Contact fromKABC(const KABC::Addressee &);
+ KOLAB_EXPORT KContacts::Addressee toKABC(const Kolab::Contact &);
+ KOLAB_EXPORT Kolab::Contact fromKABC(const KContacts::Addressee &);
- KOLAB_EXPORT KABC::ContactGroup toKABC(const Kolab::DistList &);
- KOLAB_EXPORT Kolab::DistList fromKABC(const KABC::ContactGroup &);
+ KOLAB_EXPORT KContacts::ContactGroup toKABC(const Kolab::DistList &);
+ KOLAB_EXPORT Kolab::DistList fromKABC(const KContacts::ContactGroup &);
};
};
diff --git a/conversion/kcalconversion.cpp b/conversion/kcalconversion.cpp
index a82b6a2..bec4478 100644
--- a/conversion/kcalconversion.cpp
+++ b/conversion/kcalconversion.cpp
@@ -22,6 +22,7 @@
#include <QtCore/QVector>
#include <QtCore/QDebug>
#include <QUrl>
+#include <QDate>
#include <vector>
#include "kolabformat/errorhandler.h"
@@ -360,12 +361,12 @@ void getIncidence(T &i, const I &e)
a.setRole(fromRole(ptr->role()));
if (!ptr->delegate().isEmpty()) {
std::string name;
- const std::string &email = fromMailto(ptr->delegate(), name);
+ const std::string &email = fromMailto(QUrl(ptr->delegate()), name);
a.setDelegatedTo(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name));
}
if (!ptr->delegator().isEmpty()) {
std::string name;
- const std::string &email = fromMailto(ptr->delegator(), name);
+ const std::string &email = fromMailto(QUrl(ptr->delegator()), name);
a.setDelegatedFrom(std::vector<Kolab::ContactReference>() << Kolab::ContactReference(email, name));
}
const QString &cutype = ptr->customProperties().nonKDECustomProperty(CUSTOM_KOLAB_CONTACT_CUTYPE);
diff --git a/conversion/kolabconversion.cpp b/conversion/kolabconversion.cpp
index 249f051..f99ff99 100644
--- a/conversion/kolabconversion.cpp
+++ b/conversion/kolabconversion.cpp
@@ -29,14 +29,12 @@ Note fromNote(const KMime::Message::Ptr &m)
Note n;
n.setSummary(toStdString(note.title()));
n.setDescription(toStdString(note.text()));
- KDateTime created = note.creationDate();
+ KDateTime created = KDateTime(note.creationDate());
created.setTimeSpec(KDateTime::UTC);
n.setCreated(fromDate(created));
-// #if KDEPIMLIBS_VERSION >= 0x040840
-#ifdef KDEPIMLIBS_VERSION_DEVEL
n.setUid(toStdString(note.uid()));
- KDateTime lastModified = note.lastModifiedDate();
+ KDateTime lastModified = KDateTime(note.lastModifiedDate());
lastModified.setTimeSpec(KDateTime::UTC);
n.setLastModified(fromDate(lastModified));
@@ -71,7 +69,6 @@ Note fromNote(const KMime::Message::Ptr &m)
}
n.setAttachments(attachments);
-#endif
return n;
}
@@ -81,10 +78,9 @@ KMime::Message::Ptr toNote(const Note &n)
note.setTitle(fromStdString(n.summary()));
note.setText(fromStdString(n.description()));
note.setFrom("kolab@kde4");
- note.setCreationDate(toDate(n.created()));
-#ifdef KDEPIMLIBS_VERSION_DEVEL
+ note.setCreationDate(toDate(n.created()).dateTime());
note.setUid(fromStdString(n.uid()));
- note.setLastModifiedDate(toDate(n.lastModified()));
+ note.setLastModifiedDate(toDate(n.lastModified()).dateTime());
switch (n.classification()) {
case Kolab::ClassPrivate:
note.setClassification(Akonadi::NoteUtils::NoteMessageWrapper::Private);
@@ -110,7 +106,6 @@ KMime::Message::Ptr toNote(const Note &n)
foreach (const Kolab::CustomProperty &a, n.customProperties()) {
note.custom().insert(fromStdString(a.identifier), fromStdString(a.value));
}
-#endif
return note.message();
}
diff --git a/freebusy/freebusy.cpp b/freebusy/freebusy.cpp
index 7b20c20..2af8b82 100644
--- a/freebusy/freebusy.cpp
+++ b/freebusy/freebusy.cpp
@@ -22,9 +22,9 @@
#include "libkolab-version.h"
#include <kcalcore/freebusy.h>
#include <kcalcore/icalformat.h>
-#include <kdebug.h>
#include <quuid.h>
-
+#include <QTime>
+#include <QDebug>
// namespace KCalCore {
// struct KCalFreebusy
diff --git a/icalendar/imip.cpp b/icalendar/imip.cpp
index 11e8962..93183ec 100644
--- a/icalendar/imip.cpp
+++ b/icalendar/imip.cpp
@@ -21,13 +21,13 @@
#include "imip.h"
#include <kcalutils/incidenceformatter.h>
-#include <kpimutils/email.h>
+#include <KEmailAddress>
#include <kmime/kmime_message.h>
#include <QDebug>
// #include <klocalizedstring.h>
#include <ksystemtimezone.h>
#include <kdebug.h>
-
+#include <QTime>
/*
* The code in here is copy paste work from kdepim/calendarsupport.
*
@@ -74,7 +74,7 @@ KMime::Message::Ptr createMessage( const QString &from, const QString &_to,
if( bccMe ) {
message->bcc()->fromUnicodeString( from, "utf-8" ); //from==me, right?
}
- message->date()->setDateTime( KDateTime::currentLocalDateTime() );
+ message->date()->setDateTime( KDateTime::currentLocalDateTime().dateTime() );
message->subject()->fromUnicodeString( subject, "utf-8" );
if ( outlookConformInvitation ) {
@@ -170,10 +170,10 @@ QByteArray mailAttendees( const KCalCore::IncidenceBase::Ptr &incidence,
// Build a nice address for this attendee including the CN.
QString tname, temail;
- const QString username = KPIMUtils::quoteNameIfNecessary( a->name() );
+ const QString username = KEmailAddress::quoteNameIfNecessary( a->name() );
// ignore the return value from extractEmailAddressAndName() because
// it will always be false since tusername does not contain "@domain".
- KPIMUtils::extractEmailAddressAndName( username, temail/*byref*/, tname/*byref*/ );
+ KEmailAddress::extractEmailAddressAndName( username, temail/*byref*/, tname/*byref*/ );
tname += QLatin1String( " <" ) + email + QLatin1Char( '>' );
// Optional Participants and Non-Participants are copied on the email
diff --git a/kolabformat/errorhandler.h b/kolabformat/errorhandler.h
index 2a3d34e..5ac5375 100644
--- a/kolabformat/errorhandler.h
+++ b/kolabformat/errorhandler.h
@@ -19,7 +19,7 @@
#ifndef ERRORHANDLER_H
#define ERRORHANDLER_H
-#include <kolab_export.h>
+#include "kolab_export.h"
#include <QString>
#include <QList>
diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index 681b4a5..75c1cab 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -22,7 +22,7 @@
#include "errorhandler.h"
#include "libkolab-version.h"
-#include <kolabbase.h>
+#include "kolabbase.h"
#include <kolabformatV2/journal.h>
#include <kolabformatV2/task.h>
#include <kolabformatV2/event.h>
@@ -159,15 +159,15 @@ public:
mOverrideObjectType(InvalidObject),
mDoOverrideVersion(false)
{
- mAddressee = KABC::Addressee();
+ mAddressee = KContacts::Addressee();
}
ObjectType readKolabV2(const KMime::Message::Ptr &msg, Kolab::ObjectType objectType);
ObjectType readKolabV3(const KMime::Message::Ptr &msg, Kolab::ObjectType objectType);
KCalCore::Incidence::Ptr mIncidence;
- KABC::Addressee mAddressee;
- KABC::ContactGroup mContactGroup;
+ KContacts::Addressee mAddressee;
+ KContacts::ContactGroup mContactGroup;
KMime::Message::Ptr mNote;
QStringList mDictionary;
QString mDictionaryLanguage;
@@ -177,14 +177,9 @@ public:
ObjectType mOverrideObjectType;
Version mOverrideVersion;
bool mDoOverrideVersion;
-
-#ifdef HAVE_RELATION_H
Akonadi::Relation mRelation;
-#endif
-#ifdef HAVE_TAG_H
Akonadi::Tag mTag;
QStringList mTagMembers;
-#endif
};
//@endcond
@@ -348,7 +343,7 @@ ObjectType KolabObjectReader::Private::readKolabV2(const KMime::Message::Ptr &ms
mContactGroup = contactGroupFromKolab(xmlData);
break;
case NoteObject:
- mNote = noteFromKolab(xmlData, msg->date()->dateTime());
+ mNote = noteFromKolab(xmlData, KDateTime(msg->date()->dateTime()));
break;
default:
CRITICAL("no kolab object found ");
@@ -426,7 +421,6 @@ ObjectType KolabObjectReader::Private::readKolabV3(const KMime::Message::Ptr &ms
mFreebusy = fb;
}
break;
-#ifdef HAVE_TAG_H
case RelationConfigurationObject: {
const Kolab::Configuration &configuration = Kolab::readConfiguration(xml, false);
const Kolab::Relation &relation = configuration.relation();
@@ -442,7 +436,6 @@ ObjectType KolabObjectReader::Private::readKolabV3(const KMime::Message::Ptr &ms
mTagMembers << Conversion::fromStdString(member);
}
} else if (relation.type() == "generic") {
-#ifdef HAVE_RELATION_H
if (relation.members().size() == 2) {
mRelation = Akonadi::Relation();
mRelation.setRemoteId(Conversion::fromStdString(configuration.uid()).toLatin1());
@@ -456,14 +449,12 @@ ObjectType KolabObjectReader::Private::readKolabV3(const KMime::Message::Ptr &ms
Critical() << "generic relation had wrong number of members:" << relation.members().size();
printMessageDebugInfo(msg);
}
-#endif
} else {
Critical() << "unknown configuration object type" << relation.type();
printMessageDebugInfo(msg);
}
}
break;
-#endif
default:
Critical() << "no kolab object found ";
printMessageDebugInfo(msg);
@@ -564,12 +555,12 @@ KCalCore::Incidence::Ptr KolabObjectReader::getIncidence() const
return d->mIncidence;
}
-KABC::Addressee KolabObjectReader::getContact() const
+KContacts::Addressee KolabObjectReader::getContact() const
{
return d->mAddressee;
}
-KABC::ContactGroup KolabObjectReader::getDistlist() const
+KContacts::ContactGroup KolabObjectReader::getDistlist() const
{
return d->mContactGroup;
}
@@ -590,7 +581,6 @@ Freebusy KolabObjectReader::getFreebusy() const
return d->mFreebusy;
}
-#ifdef HAVE_TAG_H
bool KolabObjectReader::isTag() const
{
return !d->mTag.gid().isEmpty();
@@ -605,9 +595,7 @@ QStringList KolabObjectReader::getTagMembers() const
{
return d->mTagMembers;
}
-#endif
-#ifdef HAVE_RELATION_H
bool KolabObjectReader::isRelation() const
{
return d->mRelation.isValid();
@@ -617,7 +605,6 @@ Akonadi::Relation KolabObjectReader::getRelation() const
{
return d->mRelation;
}
-#endif
//Normalize incidences before serializing them
@@ -630,9 +617,9 @@ KCalCore::Incidence::Ptr normalizeIncidence(KCalCore::Incidence::Ptr original)
return i;
}
/*
-KABC::Addressee normalizeContact(const KABC::Addressee &a)
+KContacts::Addressee normalizeContact(const KContacts::Addressee &a)
{
- KABC::Addressee addresee = a;
+ KContacts::Addressee addresee = a;
Q_FOREACH (KCalCore::Attachment::Ptr attachment, addresee.photo()) {
attachment->setUri(QString::fromLatin1("cid:")+QString::fromLatin1(KMime::uniqueString() + '@' + "kolab.resource.akonadi")); //Serialize the attachment as attachment with uri, referencing the created mime-part
}
@@ -724,7 +711,7 @@ KMime::Message::Ptr KolabObjectWriter::writeIncidence(const KCalCore::Incidence:
}
-KMime::Message::Ptr KolabObjectWriter::writeContact(const KABC::Addressee &addressee, Version v, const QString &productId)
+KMime::Message::Ptr KolabObjectWriter::writeContact(const KContacts::Addressee &addressee, Version v, const QString &productId)
{
ErrorHandler::clearErrors();
if (v == KolabV3) {
@@ -737,7 +724,7 @@ KMime::Message::Ptr KolabObjectWriter::writeContact(const KABC::Addressee &addre
return contactToKolabFormat(contact, getProductId(productId));
}
-KMime::Message::Ptr KolabObjectWriter::writeDistlist(const KABC::ContactGroup &distlist, Version v, const QString &productId)
+KMime::Message::Ptr KolabObjectWriter::writeDistlist(const KContacts::ContactGroup &distlist, Version v, const QString &productId)
{
ErrorHandler::clearErrors();
if (v == KolabV3) {
@@ -797,7 +784,6 @@ KMime::Message::Ptr KolabObjectWriter::writeFreebusy(const Freebusy &freebusy, V
return Mime::createMessage(Conversion::fromStdString(freebusy.uid()), xCalMimeType(), freebusyKolabType(), Conversion::fromStdString(v3String).toUtf8(), true, getProductId(productId));
}
-#ifdef HAVE_TAG_H
KMime::Message::Ptr writeRelationHelper(const Kolab::Relation &relation, const QByteArray &uid, const QString &productId)
{
Kolab::Configuration configuration(relation); //TODO preserve creation/lastModified date
@@ -824,9 +810,7 @@ KMime::Message::Ptr KolabObjectWriter::writeTag(const Akonadi::Tag &tag, const Q
return writeRelationHelper(relation, tag.gid(), productId);
}
-#endif
-#ifdef HAVE_RELATION_H
KMime::Message::Ptr KolabObjectWriter::writeRelation(const Akonadi::Relation &relation, const QStringList &items, Version v, const QString &productId)
{
ErrorHandler::clearErrors();
@@ -848,7 +832,6 @@ KMime::Message::Ptr KolabObjectWriter::writeRelation(const Akonadi::Relation &re
return writeRelationHelper(kolabRelation, relation.remoteId(), productId);
}
-#endif
}; //Namespace
diff --git a/kolabformat/kolabobject.h b/kolabformat/kolabobject.h
index b3ec9c0..4a439bb 100644
--- a/kolabformat/kolabobject.h
+++ b/kolabformat/kolabobject.h
@@ -20,17 +20,11 @@
#include <kolab_export.h>
-#include <libkolab_config.h>
-
-#ifdef HAVE_TAG_H
-#include <akonadi/item.h>
-#include <akonadi/tag.h>
-#endif
-#ifdef HAVE_RELATION_H
-#include <akonadi/relation.h>
-#endif
-#include <kabc/addressee.h>
-#include <kabc/contactgroup.h>
+#include <AkonadiCore/Item>
+#include <AkonadiCore/Tag>
+#include <AkonadiCore/Relation>
+#include <kcontacts/addressee.h>
+#include <kcontacts/contactgroup.h>
#include <kcalcore/incidence.h>
#include <kcalcore/event.h>
#include <kcalcore/journal.h>
@@ -103,20 +97,16 @@ public:
KCalCore::Todo::Ptr getTodo() const;
KCalCore::Journal::Ptr getJournal() const;
KCalCore::Incidence::Ptr getIncidence() const;
- KABC::Addressee getContact() const;
- KABC::ContactGroup getDistlist() const;
+ KContacts::Addressee getContact() const;
+ KContacts::ContactGroup getDistlist() const;
KMime::Message::Ptr getNote() const;
QStringList getDictionary(QString &lang) const;
Freebusy getFreebusy() const;
-#ifdef HAVE_TAG_H
bool isTag() const;
Akonadi::Tag getTag() const;
QStringList getTagMembers() const;
-#endif
-#ifdef HAVE_RELATION_H
bool isRelation() const;
Akonadi::Relation getRelation() const;
-#endif
private:
//@cond PRIVATE
@@ -138,17 +128,13 @@ public:
static KMime::Message::Ptr writeTodo(const KCalCore::Todo::Ptr &, Version v = KolabV3, const QString &productId = QString(),const QString &tz = QString());
static KMime::Message::Ptr writeJournal(const KCalCore::Journal::Ptr &, Version v = KolabV3, const QString &productId = QString(),const QString &tz = QString());
static KMime::Message::Ptr writeIncidence(const KCalCore::Incidence::Ptr &, Version v = KolabV3, const QString &productId = QString(),const QString &tz = QString());
- static KMime::Message::Ptr writeContact(const KABC::Addressee &, Version v = KolabV3, const QString &productId = QString());
- static KMime::Message::Ptr writeDistlist(const KABC::ContactGroup &, Version v = KolabV3, const QString &productId = QString());
+ static KMime::Message::Ptr writeContact(const KContacts::Addressee &, Version v = KolabV3, const QString &productId = QString());
+ static KMime::Message::Ptr writeDistlist(const KContacts::ContactGroup &, Version v = KolabV3, const QString &productId = QString());
static KMime::Message::Ptr writeNote(const KMime::Message::Ptr &, Version v = KolabV3, const QString &productId = QString());
static KMime::Message::Ptr writeDictionary(const QStringList &, const QString &lang, Version v = KolabV3, const QString &productId = QString());
static KMime::Message::Ptr writeFreebusy(const Kolab::Freebusy &, Version v = KolabV3, const QString &productId = QString());
-#ifdef HAVE_TAG_H
static KMime::Message::Ptr writeTag(const Akonadi::Tag &, const QStringList &items, Version v = KolabV3, const QString &productId = QString());
-#endif
-#ifdef HAVE_RELATION_H
static KMime::Message::Ptr writeRelation(const Akonadi::Relation &, const QStringList &items, Version v = KolabV3, const QString &productId = QString());
-#endif
};
diff --git a/kolabformat/mimeobject.cpp b/kolabformat/mimeobject.cpp
index 559cf75..336104b 100644
--- a/kolabformat/mimeobject.cpp
+++ b/kolabformat/mimeobject.cpp
@@ -118,7 +118,7 @@ Note MIMEObject::readNote(const std::string &s){
}
std::string MIMEObject::writeContact(const Contact &contact, Version version, const std::string &productId){
- KABC::Addressee kContact = Conversion::toKABC(contact);
+ KContacts::Addressee kContact = Conversion::toKABC(contact);
KMime::Message::Ptr msg = KolabObjectWriter().writeContact(kContact, version, QString::fromStdString(productId));
msg->assemble();
@@ -133,13 +133,13 @@ Contact MIMEObject::readContact(const std::string &s){
msg->setContent(QByteArray(s.c_str()));
msg->parse();
- KABC::Addressee contact = KolabObjectReader(msg).getContact();
+ KContacts::Addressee contact = KolabObjectReader(msg).getContact();
return Conversion::fromKABC(contact);
}
std::string MIMEObject::writeDistlist(const DistList &distlist, Version version, const std::string &productId){
- KABC::ContactGroup kDistlist = Conversion::toKABC(distlist);
+ KContacts::ContactGroup kDistlist = Conversion::toKABC(distlist);
KMime::Message::Ptr msg = KolabObjectWriter().writeDistlist(kDistlist, version, QString::fromStdString(productId));
msg->assemble();
@@ -154,7 +154,7 @@ DistList MIMEObject::readDistlist(const std::string &s){
msg->setContent(QByteArray(s.c_str()));
msg->parse();
- KABC::ContactGroup distlist = KolabObjectReader(msg).getDistlist();
+ KContacts::ContactGroup distlist = KolabObjectReader(msg).getDistlist();
return Conversion::fromKABC(distlist);
}
diff --git a/kolabformat/v2helpers.cpp b/kolabformat/v2helpers.cpp
index 03b4b19..ad3b7dc 100644
--- a/kolabformat/v2helpers.cpp
+++ b/kolabformat/v2helpers.cpp
@@ -29,7 +29,7 @@
#include "mime/mimeutils.h"
#include "kolabformat/errorhandler.h"
-#include <kabc/contactgroup.h>
+#include <kcontacts/contactgroup.h>
#include <qdom.h>
#include <kdebug.h>
@@ -81,13 +81,13 @@ static QImage getPicture(const QString &pictureAttachmentName, const KMime::Mess
return image;
}
-KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Message::Ptr &data)
+KContacts::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Message::Ptr &data)
{
if (!data) {
Critical() << "empty message";
- return KABC::Addressee();
+ return KContacts::Addressee();
}
- KABC::Addressee addressee;
+ KContacts::Addressee addressee;
// Debug() << "xmlData " << xmlData;
KolabV2::Contact contact(QString::fromUtf8(xmlData));
QByteArray type;
@@ -117,9 +117,9 @@ KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Mess
return addressee;
}
-KABC::Addressee addresseeFromKolab(const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName)
+KContacts::Addressee addresseeFromKolab(const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName)
{
- KABC::Addressee addressee;
+ KContacts::Addressee addressee;
KolabV2::Contact contact(QString::fromUtf8(xmlData));
pictureAttachmentName = contact.pictureAttachmentName();
logoAttachmentName = contact.logoAttachmentName();
@@ -181,9 +181,9 @@ KMime::Message::Ptr contactToKolabFormat(const KolabV2::Contact& contact, const
return message;
}
-KABC::ContactGroup contactGroupFromKolab(const QByteArray &xmlData)
+KContacts::ContactGroup contactGroupFromKolab(const QByteArray &xmlData)
{
- KABC::ContactGroup contactGroup;
+ KContacts::ContactGroup contactGroup;
// kDebug() << "xmlData " << xmlData;
KolabV2::DistributionList distList(QString::fromUtf8(xmlData));
distList.saveTo(&contactGroup);
@@ -219,7 +219,7 @@ KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &cr
note.setTitle(j.summary());
note.setText(j.body().toUtf8());
note.setFrom("kolab@kde4");
- note.setCreationDate(creationDate);
+ note.setCreationDate(creationDate.dateTime());
return note.message();
}
diff --git a/kolabformat/v2helpers.h b/kolabformat/v2helpers.h
index e047d35..a6d1a61 100644
--- a/kolabformat/v2helpers.h
+++ b/kolabformat/v2helpers.h
@@ -30,7 +30,7 @@
#include "mime/mimeutils.h"
#include "kolabformat/errorhandler.h"
-#include <kabc/contactgroup.h>
+#include <kcontacts/contactgroup.h>
#include <qdom.h>
#include <qbuffer.h>
@@ -76,12 +76,12 @@ static inline IncidencePtr incidenceFromKolabImpl( const KMime::Message::Ptr &da
return ptr;
}
-KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Message::Ptr &data);
-KABC::Addressee addresseeFromKolab( const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName);
+KContacts::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime::Message::Ptr &data);
+KContacts::Addressee addresseeFromKolab( const QByteArray &xmlData, QString &pictureAttachmentName, QString &logoAttachmentName, QString &soundAttachmentName);
KMime::Message::Ptr contactToKolabFormat(const KolabV2::Contact& contact, const QString &productId);
-KABC::ContactGroup contactGroupFromKolab(const QByteArray &xmlData);
+KContacts::ContactGroup contactGroupFromKolab(const QByteArray &xmlData);
KMime::Message::Ptr distListToKolabFormat(const KolabV2::DistributionList& distList, const QString &productId);
KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &creationDate);
diff --git a/kolabformat/xmlobject.cpp b/kolabformat/xmlobject.cpp
index e9e2f7a..884f600 100644
--- a/kolabformat/xmlobject.cpp
+++ b/kolabformat/xmlobject.cpp
@@ -210,7 +210,7 @@ Contact XMLObject::readContact(const std::string& s, Version version)
QString pictureAttachmentName;
QString logoAttachmentName;
QString soundAttachmentName;
- const KABC::Addressee addressee = addresseeFromKolab(xmlData, pictureAttachmentName, logoAttachmentName, soundAttachmentName);
+ const KContacts::Addressee addressee = addresseeFromKolab(xmlData, pictureAttachmentName, logoAttachmentName, soundAttachmentName);
mPictureAttachmentName = Conversion::toStdString(pictureAttachmentName);
mLogoAttachmentName = Conversion::toStdString(logoAttachmentName);
mSoundAttachmentName = Conversion::toStdString(soundAttachmentName);
@@ -224,7 +224,7 @@ std::string XMLObject::writeContact(const Contact &contact, Version version, con
mWrittenUID.clear();
if (version == KolabV2) {
//FIXME attachment names are hardcoded for now
- KABC::Addressee addressee = Conversion::toKABC(contact);
+ KContacts::Addressee addressee = Conversion::toKABC(contact);
if (addressee.uid().isEmpty()) {
addressee.setUid(createUuid());
}
@@ -241,7 +241,7 @@ DistList XMLObject::readDistlist(const std::string& s, Version version)
{
if (version == KolabV2) {
const QByteArray xmlData(s.c_str(), s.size());
- const KABC::ContactGroup contactGroup = contactGroupFromKolab(xmlData);
+ const KContacts::ContactGroup contactGroup = contactGroupFromKolab(xmlData);
return Conversion::fromKABC(contactGroup);
}
return Kolab::readDistlist(s, false);
@@ -251,7 +251,7 @@ std::string XMLObject::writeDistlist(const DistList &distlist, Version version,
{
mWrittenUID.clear();
if (version == KolabV2) {
- KABC::ContactGroup contactGroup = Conversion::toKABC(distlist);
+ KContacts::ContactGroup contactGroup = Conversion::toKABC(distlist);
if (contactGroup.id().isEmpty()) {
contactGroup.setId(createUuid());
}
diff --git a/kolabformatV2/contact.cpp b/kolabformatV2/contact.cpp
index a788130..e25bdfb 100644
--- a/kolabformatV2/contact.cpp
+++ b/kolabformatV2/contact.cpp
@@ -32,7 +32,7 @@
#include "contact.h"
-#include <kabc/addressee.h>
+#include <kcontacts/addressee.h>
#include <kdebug.h>
#include <QFile>
#include <float.h>
@@ -45,7 +45,7 @@ static const char* s_soundAttachmentName = "sound";
static const char* s_unhandledTagAppName = "KOLABUNHANDLED"; // no hyphens in appnames!
// saving (addressee->xml)
-Contact::Contact( const KABC::Addressee* addr )
+Contact::Contact( const KContacts::Addressee* addr )
: mHasGeo( false )
{
setFields( addr );
@@ -804,11 +804,11 @@ QString Contact::saveXML() const
return document.toString();
}
-static QString addressTypeToString( int /*KABC::Address::Type*/ type )
+static QString addressTypeToString( int /*KContacts::Address::Type*/ type )
{
- if ( type & KABC::Address::Home )
+ if ( type & KContacts::Address::Home )
return "home";
- if ( type & KABC::Address::Work )
+ if ( type & KContacts::Address::Work )
return "business";
return "other";
}
@@ -816,110 +816,110 @@ static QString addressTypeToString( int /*KABC::Address::Type*/ type )
static int addressTypeFromString( const QString& type )
{
if ( type == "home" )
- return KABC::Address::Home;
+ return KContacts::Address::Home;
if ( type == "business" )
- return KABC::Address::Work;
+ return KContacts::Address::Work;
// well, this shows "other" in the editor, which is what we want...
- return KABC::Address::Dom | KABC::Address::Intl | KABC::Address::Postal | KABC::Address::Parcel;
+ return KContacts::Address::Dom | KContacts::Address::Intl | KContacts::Address::Postal | KContacts::Address::Parcel;
}
-static QStringList phoneTypeToString( KABC::PhoneNumber::Type type )
+static QStringList phoneTypeToString( KContacts::PhoneNumber::Type type )
{
// KABC has a bitfield, i.e. the same phone number can be used for work and home
// and fax and cellphone etc. etc.
// So when saving we need to create as many tags as bits that were set.
QStringList types;
- if ( type & KABC::PhoneNumber::Fax ) {
- if ( type & KABC::PhoneNumber::Home )
+ if ( type & KContacts::PhoneNumber::Fax ) {
+ if ( type & KContacts::PhoneNumber::Home )
types << "homefax";
- else // assume work -- if ( type & KABC::PhoneNumber::Work )
+ else // assume work -- if ( type & KContacts::PhoneNumber::Work )
types << "businessfax";
- type = type & ~KABC::PhoneNumber::Home;
- type = type & ~KABC::PhoneNumber::Work;
+ type = type & ~KContacts::PhoneNumber::Home;
+ type = type & ~KContacts::PhoneNumber::Work;
}
// To support both "home1" and "home2", map Home+Pref to home1
- if ( ( type & KABC::PhoneNumber::Home ) && ( type & KABC::PhoneNumber::Pref ) )
+ if ( ( type & KContacts::PhoneNumber::Home ) && ( type & KContacts::PhoneNumber::Pref ) )
{
types << "home1";
- type = type & ~KABC::PhoneNumber::Home;
- type = type & ~KABC::PhoneNumber::Pref;
+ type = type & ~KContacts::PhoneNumber::Home;
+ type = type & ~KContacts::PhoneNumber::Pref;
}
// To support both "business1" and "business2", map Work+Pref to business1
- if ( ( type & KABC::PhoneNumber::Work ) && ( type & KABC::PhoneNumber::Pref ) )
+ if ( ( type & KContacts::PhoneNumber::Work ) && ( type & KContacts::PhoneNumber::Pref ) )
{
types << "business1";
- type = type & ~KABC::PhoneNumber::Work;
- type = type & ~KABC::PhoneNumber::Pref;
+ type = type & ~KContacts::PhoneNumber::Work;
+ type = type & ~KContacts::PhoneNumber::Pref;
}
- if ( type & KABC::PhoneNumber::Home )
+ if ( type & KContacts::PhoneNumber::Home )
types << "home2";
- if ( type & KABC::PhoneNumber::Msg ) // Msg==messaging
+ if ( type & KContacts::PhoneNumber::Msg ) // Msg==messaging
types << "company";
- if ( type & KABC::PhoneNumber::Work )
+ if ( type & KContacts::PhoneNumber::Work )
types << "business2";
- if ( type & KABC::PhoneNumber::Pref )
+ if ( type & KContacts::PhoneNumber::Pref )
types << "primary";
- if ( type & KABC::PhoneNumber::Voice )
+ if ( type & KContacts::PhoneNumber::Voice )
types << "callback"; // ##
- if ( type & KABC::PhoneNumber::Cell )
+ if ( type & KContacts::PhoneNumber::Cell )
types << "mobile";
- if ( type & KABC::PhoneNumber::Video )
+ if ( type & KContacts::PhoneNumber::Video )
types << "radio"; // ##
- if ( type & KABC::PhoneNumber::Bbs )
+ if ( type & KContacts::PhoneNumber::Bbs )
types << "ttytdd";
- if ( type & KABC::PhoneNumber::Modem )
+ if ( type & KContacts::PhoneNumber::Modem )
types << "telex"; // #
- if ( type & KABC::PhoneNumber::Car )
+ if ( type & KContacts::PhoneNumber::Car )
types << "car";
- if ( type & KABC::PhoneNumber::Isdn )
+ if ( type & KContacts::PhoneNumber::Isdn )
types << "isdn";
- if ( type & KABC::PhoneNumber::Pcs )
+ if ( type & KContacts::PhoneNumber::Pcs )
types << "assistant"; // ## Assistant is e.g. secretary
- if ( type & KABC::PhoneNumber::Pager )
+ if ( type & KContacts::PhoneNumber::Pager )
types << "pager";
return types;
}
-static KABC::PhoneNumber::Type phoneTypeFromString( const QString& type )
+static KContacts::PhoneNumber::Type phoneTypeFromString( const QString& type )
{
if ( type == "homefax" )
- return KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax;
+ return KContacts::PhoneNumber::Home | KContacts::PhoneNumber::Fax;
if ( type == "businessfax" )
- return KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax;
+ return KContacts::PhoneNumber::Work | KContacts::PhoneNumber::Fax;
if ( type == "business1" )
- return KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref;
+ return KContacts::PhoneNumber::Work | KContacts::PhoneNumber::Pref;
if ( type == "business2" )
- return KABC::PhoneNumber::Work;
+ return KContacts::PhoneNumber::Work;
if ( type == "home1" )
- return KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref;
+ return KContacts::PhoneNumber::Home | KContacts::PhoneNumber::Pref;
if ( type == "home2" )
- return KABC::PhoneNumber::Home;
+ return KContacts::PhoneNumber::Home;
if ( type == "company" )
- return KABC::PhoneNumber::Msg;
+ return KContacts::PhoneNumber::Msg;
if ( type == "primary" )
- return KABC::PhoneNumber::Pref;
+ return KContacts::PhoneNumber::Pref;
if ( type == "callback" )
- return KABC::PhoneNumber::Voice;
+ return KContacts::PhoneNumber::Voice;
if ( type == "mobile" )
- return KABC::PhoneNumber::Cell;
+ return KContacts::PhoneNumber::Cell;
if ( type == "radio" )
- return KABC::PhoneNumber::Video;
+ return KContacts::PhoneNumber::Video;
if ( type == "ttytdd" )
- return KABC::PhoneNumber::Bbs;
+ return KContacts::PhoneNumber::Bbs;
if ( type == "telex" )
- return KABC::PhoneNumber::Modem;
+ return KContacts::PhoneNumber::Modem;
if ( type == "car" )
- return KABC::PhoneNumber::Car;
+ return KContacts::PhoneNumber::Car;
if ( type == "isdn" )
- return KABC::PhoneNumber::Isdn;
+ return KContacts::PhoneNumber::Isdn;
if ( type == "assistant" )
- return KABC::PhoneNumber::Pcs;
+ return KContacts::PhoneNumber::Pcs;
if ( type == "pager" )
- return KABC::PhoneNumber::Pager;
- return KABC::PhoneNumber::Home; // whatever
+ return KContacts::PhoneNumber::Pager;
+ return KContacts::PhoneNumber::Home; // whatever
}
static const char* s_knownCustomFields[] = {
@@ -936,7 +936,7 @@ static const char* s_knownCustomFields[] = {
// The saving is addressee -> Contact -> xml, this is the first part
-void Contact::setFields( const KABC::Addressee* addressee )
+void Contact::setFields( const KContacts::Addressee* addressee )
{
KolabBase::setFields( addressee );
@@ -966,7 +966,7 @@ void Contact::setFields( const KABC::Addressee* addressee )
const QStringList emails = addressee->emails();
// Conversion problem here:
- // KABC::Addressee has only one full name and N addresses, but the XML format
+ // KContacts::Addressee has only one full name and N addresses, but the XML format
// has N times (fullname+address). So we just copy the fullname over and ignore it on loading.
for ( QStringList::ConstIterator it = emails.constBegin(); it != emails.constEnd(); ++it ) {
Email email;
@@ -980,8 +980,8 @@ void Contact::setFields( const KABC::Addressee* addressee )
// Now the real-world addresses
QString preferredAddress = "home";
- const KABC::Address::List addresses = addressee->addresses();
- for ( KABC::Address::List::ConstIterator it = addresses.constBegin() ; it != addresses.constEnd(); ++it ) {
+ const KContacts::Address::List addresses = addressee->addresses();
+ for ( KContacts::Address::List::ConstIterator it = addresses.constBegin() ; it != addresses.constEnd(); ++it ) {
Address address;
address.kdeAddressType = (*it).type();
address.type = addressTypeToString( address.kdeAddressType );
@@ -994,14 +994,14 @@ void Contact::setFields( const KABC::Addressee* addressee )
// ## TODO not in the XML format: extended address info.
// ## KDE-specific tags? Or hiding those fields? Or adding a warning?
addAddress( address );
- if ( address.kdeAddressType & KABC::Address::Pref ) {
+ if ( address.kdeAddressType & KContacts::Address::Pref ) {
preferredAddress = address.type; // home, business or other
}
}
setPreferredAddress( preferredAddress );
- const KABC::PhoneNumber::List phones = addressee->phoneNumbers();
- for ( KABC::PhoneNumber::List::ConstIterator it = phones.constBegin(); it != phones.constEnd(); ++it ) {
+ const KContacts::PhoneNumber::List phones = addressee->phoneNumbers();
+ for ( KContacts::PhoneNumber::List::ConstIterator it = phones.constBegin(); it != phones.constEnd(); ++it ) {
// Create a tag per phone type set in the bitfield
QStringList types = phoneTypeToString( (*it).type() );
for( QStringList::ConstIterator typit = types.constBegin(); typit != types.constEnd(); ++typit ) {
@@ -1040,7 +1040,7 @@ void Contact::setFields( const KABC::Addressee* addressee )
knownCustoms << QString::fromLatin1( *p );
QStringList customs = addressee->customs();
for( QStringList::ConstIterator it = customs.constBegin(); it != customs.constEnd(); ++it ) {
- // KABC::Addressee doesn't offer a real way to iterate over customs, other than splitting strings ourselves
+ // KContacts::Addressee doesn't offer a real way to iterate over customs, other than splitting strings ourselves
// The format is "app-name:value".
int pos = (*it).indexOf( '-' );
if ( pos == -1 ) continue;
@@ -1078,7 +1078,7 @@ void Contact::setFields( const KABC::Addressee* addressee )
// The loading is: xml -> Contact -> addressee, this is the second part
-void Contact::saveTo( KABC::Addressee* addressee )
+void Contact::saveTo( KContacts::Addressee* addressee )
{
// TODO: This needs the same set of TODOs as the setFields method
KolabBase::saveTo( addressee );
@@ -1090,7 +1090,7 @@ void Contact::saveTo( KABC::Addressee* addressee )
addressee->setPrefix( prefix() );
addressee->setSuffix( suffix() );
addressee->setOrganization( organization() );
- addressee->setUrl( webPage() );
+ addressee->setUrl( QUrl(webPage()) );
addressee->insertCustom( "KADDRESSBOOK", "X-IMAddress", imAddress() );
addressee->setDepartment( department() );
addressee->insertCustom( "KADDRESSBOOK", "X-Office", officeLocation() );
@@ -1115,23 +1115,23 @@ void Contact::saveTo( KABC::Addressee* addressee )
// We need to store both the original attachment name and the picture data into the addressee.
// This is important, otherwise we would save the image under another attachment name w/o deleting the original one!
if ( !mPicture.isNull() ) {
- KABC::Picture picture( mPicture );
+ KContacts::Picture picture( mPicture );
addressee->setPhoto( picture );
}
// Note that we must save the filename in all cases, so that removing the picture
// actually deletes the attachment.
addressee->insertCustom( "KOLAB", "PictureAttachmentName", mPictureAttachmentName );
if ( !mLogo.isNull() ) {
- KABC::Picture picture( mLogo );
+ KContacts::Picture picture( mLogo );
addressee->setLogo( picture );
}
addressee->insertCustom( "KOLAB", "LogoAttachmentName", mLogoAttachmentName );
if ( !mSound.isNull() )
- addressee->setSound( KABC::Sound( mSound ) );
+ addressee->setSound( KContacts::Sound( mSound ) );
addressee->insertCustom( "KOLAB", "SoundAttachmentName", mSoundAttachmentName );
if ( mHasGeo )
- addressee->setGeo( KABC::Geo( mLatitude, mLongitude ) );
+ addressee->setGeo( KContacts::Geo( mLatitude, mLongitude ) );
QStringList emailAddresses;
for ( QList<Email>::ConstIterator it = mEmails.constBegin(); it != mEmails.constEnd(); ++it ) {
@@ -1141,14 +1141,14 @@ void Contact::saveTo( KABC::Addressee* addressee )
addressee->setEmails( emailAddresses );
for ( QList<Address>::ConstIterator it = mAddresses.constBegin(); it != mAddresses.constEnd(); ++it ) {
- KABC::Address address;
+ KContacts::Address address;
int type = (*it).kdeAddressType;
if ( type == -1 ) { // no kde-specific type available
type = addressTypeFromString( (*it).type );
if ( (*it).type == mPreferredAddress )
- type |= KABC::Address::Pref;
+ type |= KContacts::Address::Pref;
}
- address.setType( static_cast<KABC::Address::Type>(type) );
+ address.setType( static_cast<KContacts::Address::Type>(type) );
address.setStreet( (*it).street );
address.setPostOfficeBox( (*it).pobox );
address.setLocality( (*it).locality );
@@ -1159,7 +1159,7 @@ void Contact::saveTo( KABC::Addressee* addressee )
}
for ( QList<PhoneNumber>::ConstIterator it = mPhoneNumbers.constBegin(); it != mPhoneNumbers.constEnd(); ++it ) {
- KABC::PhoneNumber number;
+ KContacts::PhoneNumber number;
number.setType( phoneTypeFromString( (*it).type ) );
number.setNumber( (*it).number );
addressee->insertPhoneNumber( number );
@@ -1172,7 +1172,7 @@ void Contact::saveTo( KABC::Addressee* addressee )
//kDebug() << addressee->customs();
}
-QImage Contact::loadPictureFromAddressee( const KABC::Picture& picture )
+QImage Contact::loadPictureFromAddressee( const KContacts::Picture& picture )
{
QImage img;
if ( !picture.isIntern() && !picture.url().isEmpty() ) {
@@ -1188,7 +1188,7 @@ QImage Contact::loadPictureFromAddressee( const KABC::Picture& picture )
return img;
}
-QByteArray KolabV2::Contact::loadSoundFromAddressee( const KABC::Sound& sound )
+QByteArray KolabV2::Contact::loadSoundFromAddressee( const KContacts::Sound& sound )
{
QByteArray data;
if ( !sound.isIntern() && !sound.url().isEmpty() ) {
diff --git a/kolabformatV2/contact.h b/kolabformatV2/contact.h
index 44ef26d..a1bf620 100644
--- a/kolabformatV2/contact.h
+++ b/kolabformatV2/contact.h
@@ -36,7 +36,7 @@
#include "kolabbase.h"
#include <qimage.h>
-namespace KABC {
+namespace KContacts {
class Addressee;
class Picture;
class Sound;
@@ -57,7 +57,7 @@ public:
Address() : kdeAddressType( -1 )
{
}
- int kdeAddressType; // KABC::Address::Type
+ int kdeAddressType; // KContacts::Address::Type
QString type; // kolab-compliant address type: home, work or other
QString street;
QString pobox;
@@ -67,11 +67,11 @@ public:
QString country;
};
- explicit Contact( const KABC::Addressee* address );
+ explicit Contact( const KContacts::Addressee* address );
Contact( const QString& xml );
~Contact();
- void saveTo( KABC::Addressee* address );
+ void saveTo( KContacts::Addressee* address );
QString type() const { return "Contact"; }
@@ -201,7 +201,7 @@ public:
QString saveXML() const;
protected:
- void setFields( const KABC::Addressee* );
+ void setFields( const KContacts::Addressee* );
private:
bool loadNameAttribute( QDomElement& element );
@@ -218,9 +218,9 @@ private:
void loadCustomAttributes( QDomElement& element );
void saveCustomAttributes( QDomElement& element ) const;
- QImage loadPictureFromAddressee( const KABC::Picture& picture );
+ QImage loadPictureFromAddressee( const KContacts::Picture& picture );
- QByteArray loadSoundFromAddressee( const KABC::Sound& sound );
+ QByteArray loadSoundFromAddressee( const KContacts::Sound& sound );
QString productID() const;
diff --git a/kolabformatV2/distributionlist.cpp b/kolabformatV2/distributionlist.cpp
index 6fe6873..6f7a3c5 100644
--- a/kolabformatV2/distributionlist.cpp
+++ b/kolabformatV2/distributionlist.cpp
@@ -31,8 +31,8 @@
#include "distributionlist.h"
-#include <kabc/addressee.h>
-#include <kabc/contactgroup.h>
+#include <kcontacts/addressee.h>
+#include <kcontacts/contactgroup.h>
#include <kdebug.h>
using namespace KolabV2;
@@ -40,7 +40,7 @@ using namespace KolabV2;
static const char* s_unhandledTagAppName = "KOLABUNHANDLED"; // no hyphens in appnames!
// saving (contactgroup->xml)
-DistributionList::DistributionList( const KABC::ContactGroup* contactGroup )
+DistributionList::DistributionList( const KContacts::ContactGroup* contactGroup )
{
setFields( contactGroup );
}
@@ -182,7 +182,7 @@ QString DistributionList::productID() const
}
// The saving is contactgroup -> DistributionList -> xml, this is the first part
-void DistributionList::setFields( const KABC::ContactGroup* contactGroup )
+void DistributionList::setFields( const KContacts::ContactGroup* contactGroup )
{
KolabBase::setFields( contactGroup );
@@ -190,7 +190,7 @@ void DistributionList::setFields( const KABC::ContactGroup* contactGroup )
// explicit contact data
for ( uint index = 0; index < contactGroup->dataCount(); ++index ) {
- const KABC::ContactGroup::Data& data = contactGroup->data( index );
+ const KContacts::ContactGroup::Data& data = contactGroup->data( index );
Member m;
m.displayName = data.name();
@@ -199,7 +199,7 @@ void DistributionList::setFields( const KABC::ContactGroup* contactGroup )
mDistrListMembers.append( m );
}
for ( uint index = 0; index < contactGroup->contactReferenceCount(); ++index ) {
- const KABC::ContactGroup::ContactReference& data = contactGroup->contactReference( index );
+ const KContacts::ContactGroup::ContactReference& data = contactGroup->contactReference( index );
Member m;
m.uid = data.uid();
@@ -212,7 +212,7 @@ void DistributionList::setFields( const KABC::ContactGroup* contactGroup )
}
// The loading is: xml -> DistributionList -> contactgroup, this is the second part
-void DistributionList::saveTo( KABC::ContactGroup* contactGroup )
+void DistributionList::saveTo( KContacts::ContactGroup* contactGroup )
{
KolabBase::saveTo( contactGroup );
@@ -221,9 +221,9 @@ void DistributionList::saveTo( KABC::ContactGroup* contactGroup )
QList<Member>::ConstIterator mit = mDistrListMembers.constBegin();
for ( ; mit != mDistrListMembers.constEnd(); ++mit ) {
if (!(*mit).uid.isEmpty()) {
- contactGroup->append(KABC::ContactGroup::ContactReference( (*mit).uid ));
+ contactGroup->append(KContacts::ContactGroup::ContactReference( (*mit).uid ));
} else {
- contactGroup->append(KABC::ContactGroup::Data( (*mit).displayName, (*mit).email ));
+ contactGroup->append(KContacts::ContactGroup::Data( (*mit).displayName, (*mit).email ));
}
}
}
diff --git a/kolabformatV2/distributionlist.h b/kolabformatV2/distributionlist.h
index f646540..088706b 100644
--- a/kolabformatV2/distributionlist.h
+++ b/kolabformatV2/distributionlist.h
@@ -34,7 +34,7 @@
#include "kolabbase.h"
-namespace KABC {
+namespace KContacts {
class ContactGroup;
}
@@ -42,11 +42,11 @@ namespace KolabV2 {
class DistributionList : public KolabBase {
public:
- explicit DistributionList( const KABC::ContactGroup* contactGroup );
+ explicit DistributionList( const KContacts::ContactGroup* contactGroup );
DistributionList( const QString& xml );
~DistributionList();
- void saveTo( KABC::ContactGroup* contactGroup );
+ void saveTo( KContacts::ContactGroup* contactGroup );
QString type() const { return "DistributionList"; }
@@ -68,7 +68,7 @@ public:
QString productID() const;
protected:
- void setFields( const KABC::ContactGroup* );
+ void setFields( const KContacts::ContactGroup* );
private:
void loadDistrListMember( const QDomElement& element );
diff --git a/kolabformatV2/event.cpp b/kolabformatV2/event.cpp
index b09612d..b439f8c 100644
--- a/kolabformatV2/event.cpp
+++ b/kolabformatV2/event.cpp
@@ -209,7 +209,7 @@ void Event::saveTo( const KCalCore::Event::Ptr &event )
{
Incidence::saveTo( event );
- event->setHasEndDate( mHasEndDate );
+ //PORT KF5 ? method removed event->setHasEndDate( mHasEndDate );
if ( mHasEndDate ) {
if ( mFloatingStatus == AllDay )
// This is an all-day event. Don't timezone move this one
diff --git a/kolabformatV2/kolabbase.cpp b/kolabformatV2/kolabbase.cpp
index a51d254..2d753b5 100644
--- a/kolabformatV2/kolabbase.cpp
+++ b/kolabformatV2/kolabbase.cpp
@@ -33,8 +33,8 @@
#include "kolabbase.h"
-#include <kabc/addressee.h>
-#include <kabc/contactgroup.h>
+#include <kcontacts/addressee.h>
+#include <kcontacts/contactgroup.h>
#include <kcalcore/incidence.h>
#include <kcalcore/journal.h>
#include <ksystemtimezone.h>
@@ -91,7 +91,7 @@ void KolabBase::saveTo( const KCalCore::Incidence::Ptr &incidence ) const
// TODO: Attachments
}
-void KolabBase::setFields( const KABC::Addressee* addressee )
+void KolabBase::setFields( const KContacts::Addressee* addressee )
{
// An addressee does not have a creation date, so somehow we should
// make one, if this is a new entry
@@ -125,16 +125,16 @@ void KolabBase::setFields( const KABC::Addressee* addressee )
const QString newCreationDate = dateTimeToString( creationDate );
if ( creationString != newCreationDate ) {
// We modified the creation date, so store it for future reference
- const_cast<KABC::Addressee*>( addressee )
+ const_cast<KContacts::Addressee*>( addressee )
->insertCustom( "KOLAB", "CreationDate", newCreationDate );
kDebug() <<"Creation date modified. New one:" << newCreationDate;
}
switch( addressee->secrecy().type() ) {
- case KABC::Secrecy::Private:
+ case KContacts::Secrecy::Private:
setSensitivity( Private );
break;
- case KABC::Secrecy::Confidential:
+ case KContacts::Secrecy::Confidential:
setSensitivity( Confidential );
break;
default:
@@ -144,7 +144,7 @@ void KolabBase::setFields( const KABC::Addressee* addressee )
// TODO: Attachments
}
-void KolabBase::saveTo( KABC::Addressee* addressee ) const
+void KolabBase::saveTo( KContacts::Addressee* addressee ) const
{
addressee->setUid( uid() );
addressee->setNote( body() );
@@ -155,19 +155,19 @@ void KolabBase::saveTo( KABC::Addressee* addressee ) const
switch( sensitivity() ) {
case Private:
- addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Private ) );
+ addressee->setSecrecy( KContacts::Secrecy( KContacts::Secrecy::Private ) );
break;
case Confidential:
- addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Confidential ) );
+ addressee->setSecrecy( KContacts::Secrecy( KContacts::Secrecy::Confidential ) );
break;
default:
- addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Public ) );
+ addressee->setSecrecy( KContacts::Secrecy( KContacts::Secrecy::Public ) );
break;
}
// TODO: Attachments
}
-void KolabBase::setFields( const KABC::ContactGroup* contactGroup )
+void KolabBase::setFields( const KContacts::ContactGroup* contactGroup )
{
// A contactgroup does not have a creation date, so somehow we should
// make one, if this is a new entry
@@ -188,7 +188,7 @@ void KolabBase::setFields( const KABC::ContactGroup* contactGroup )
setCreationDate( creationDate );
}
-void KolabBase::saveTo( KABC::ContactGroup* contactGroup ) const
+void KolabBase::saveTo( KContacts::ContactGroup* contactGroup ) const
{
contactGroup->setId( uid() );
}
diff --git a/kolabformatV2/kolabbase.h b/kolabformatV2/kolabbase.h
index 5bdfdec..001e1c6 100644
--- a/kolabformatV2/kolabbase.h
+++ b/kolabformatV2/kolabbase.h
@@ -43,7 +43,7 @@
#include <QColor>
#include <qdom.h>
-namespace KABC {
+namespace KContacts {
class Addressee;
class ContactGroup;
}
@@ -130,16 +130,16 @@ protected:
void saveTo( const KCalCore::Incidence::Ptr & ) const;
/// Read all known fields from this contact
- void setFields( const KABC::Addressee* );
+ void setFields( const KContacts::Addressee* );
/// Save all known fields into this contact
- void saveTo( KABC::Addressee* ) const;
+ void saveTo( KContacts::Addressee* ) const;
/// Read all known fields from this contact group
- void setFields( const KABC::ContactGroup* );
+ void setFields( const KContacts::ContactGroup* );
/// Save all known fields into this contact groupd
- void saveTo( KABC::ContactGroup* ) const;
+ void saveTo( KContacts::ContactGroup* ) const;
// This just makes the initial dom tree with version and doctype
static QDomDocument domTree();
diff --git a/kolabformatV2/note.cpp b/kolabformatV2/note.cpp
index 612a1a8..21ef00c 100644
--- a/kolabformatV2/note.cpp
+++ b/kolabformatV2/note.cpp
@@ -35,7 +35,7 @@
#include "libkolab-version.h"
#include <kcalcore/journal.h>
-#include <kdebug.h>
+#include <QDebug>
using namespace KolabV2;
@@ -162,9 +162,9 @@ bool Note::loadXML( const QDomDocument& document )
QDomElement e = n.toElement();
if ( !loadAttribute( e ) )
// TODO: Unhandled tag - save for later storage
- kDebug() <<"Warning: Unhandled tag" << e.tagName();
+ qDebug() <<"Warning: Unhandled tag" << e.tagName();
} else
- kDebug() <<"Node is not a comment or an element???";
+ qDebug() <<"Node is not a comment or an element???";
}
return true;
diff --git a/kolabformatV2/task.cpp b/kolabformatV2/task.cpp
index 0e6772f..80a2df3 100644
--- a/kolabformatV2/task.cpp
+++ b/kolabformatV2/task.cpp
@@ -335,8 +335,8 @@ void Task::saveTo( const KCalCore::Todo::Ptr &task )
task->setPercentComplete( percentCompleted() );
task->setStatus( status() );
- task->setHasStartDate( hasStartDate() );
- task->setHasDueDate( hasDueDate() );
+ //PORT KF5 task->setHasStartDate( hasStartDate() );
+ //PORT KF5 task->setHasDueDate( hasDueDate() );
if ( hasDueDate() )
task->setDtDue( utcToLocal( dueDate() ) );
diff --git a/libkolab_config.h.in b/libkolab_config.h.in
deleted file mode 100644
index 7cf8522..0000000
--- a/libkolab_config.h.in
+++ /dev/null
@@ -1,6 +0,0 @@
-/* This file is generated from libkolab_config.h.cmake. */
-
-/* Whether akonadi/tag.h exists. */
-#cmakedefine HAVE_TAG_H 1
-/* Whether akonadi/relation.h exists. */
-#cmakedefine HAVE_RELATION_H 1
diff --git a/mime/mimeutils.cpp b/mime/mimeutils.cpp
index e259773..f5de18e 100644
--- a/mime/mimeutils.cpp
+++ b/mime/mimeutils.cpp
@@ -20,7 +20,7 @@
#include <QtCore/qfile.h>
#include <qdom.h>
#include <kdebug.h>
-#include <kabc/addressee.h>
+#include <kcontacts/addressee.h>
#include "kolabformat/kolabdefinitions.h"
#include "kolabformat/errorhandler.h"
#include "libkolab-version.h"
@@ -122,7 +122,7 @@ KMime::Message::Ptr createMessage(const KCalCore::Incidence::Ptr &incidencePtr,
return message;
}
-KMime::Message::Ptr createMessage(const KABC::Addressee &contact, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid)
+KMime::Message::Ptr createMessage(const KContacts::Addressee &contact, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid)
{
KMime::Message::Ptr message = Mime::createMessage( xKolabType, v3, prodid );
message->subject()->fromUnicodeString( contact.uid(), "utf-8" );
@@ -201,7 +201,7 @@ KMime::Content* createExplanationPart(bool v3)
KMime::Message::Ptr createMessage(const QString& xKolabType, bool v3, const QString &prodid)
{
KMime::Message::Ptr message( new KMime::Message );
- message->date()->setDateTime( KDateTime::currentUtcDateTime() );
+ message->date()->setDateTime( KDateTime::currentUtcDateTime().dateTime() );
KMime::Headers::Generic *h = new KMime::Headers::Generic( X_KOLAB_TYPE_HEADER, message.get(), xKolabType, "utf-8" );
message->appendHeader( h );
if (v3) {
diff --git a/mime/mimeutils.h b/mime/mimeutils.h
index c3053a9..85436ec 100644
--- a/mime/mimeutils.h
+++ b/mime/mimeutils.h
@@ -23,7 +23,7 @@
#include <kcalcore/incidence.h>
#include <kcalcore/event.h>
#include <kmime/kmime_message.h>
-#include <kabc/addressee.h>
+#include <kcontacts/addressee.h>
class QDomDocument;
namespace Kolab {
@@ -45,7 +45,7 @@ void getAttachmentsById(KCalCore::Incidence::Ptr incidence, const KMime::Message
///Generic serializing functions
KMime::Message::Ptr createMessage(const KCalCore::Incidence::Ptr &incidencePtr, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid);
-KMime::Message::Ptr createMessage(const KABC::Addressee &contact, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid);
+KMime::Message::Ptr createMessage(const KContacts::Addressee &contact, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid);
KMime::Message::Ptr createMessage(const QString &subject, const QString &mimetype, const QString &xKolabType, const QByteArray &xml, bool v3, const QString &prodid);
KMime::Content* createExplanationPart();
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ef7a37f..7a54555 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -3,13 +3,11 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}")
macro(addTest TEST_NAME)
- QT4_AUTOMOC(${TEST_NAME}.cpp)
add_executable(${TEST_NAME} ${TEST_NAME}.cpp)
- target_link_libraries(${TEST_NAME} ${QT_QTTEST_LIBRARY} kolab_static)
+ target_link_libraries(${TEST_NAME} Qt5::Test kolab_static)
add_test(${TEST_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME})
endmacro()
-QT4_AUTOMOC(benchmark.cpp)
add_executable(benchmarktest benchmark.cpp)
target_link_libraries(benchmarktest ${QT_QTTEST_LIBRARY} kolab_static)
diff --git a/tests/formattest.cpp b/tests/formattest.cpp
index 84086ba..05689a5 100644
--- a/tests/formattest.cpp
+++ b/tests/formattest.cpp
@@ -29,8 +29,8 @@
#include <kolabformat.h>
#include <kcalcore/icalformat.h>
-#include <kabc/vcardconverter.h>
-#include <kabc/contactgrouptool.h>
+#include <kcontacts/vcardconverter.h>
+#include <kcontacts/contactgrouptool.h>
#include <akonadi/notes/noteutils.h>
#include "testutils.h"
@@ -242,15 +242,15 @@ void FormatTest::testContact()
QCOMPARE(reader.getVersion(), version);
QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug);
- KABC::Addressee convertedAddressee = reader.getContact();
+ KContacts::Addressee convertedAddressee = reader.getContact();
QVERIFY(!convertedAddressee.isEmpty());
//Parse vcard
QFile vcardFile( vcardFileName );
QVERIFY( vcardFile.open( QFile::ReadOnly ) );
- KABC::VCardConverter converter;
+ KContacts::VCardConverter converter;
const QByteArray &c = vcardFile.readAll();
- KABC::Addressee realAddressee = converter.parseVCard( c );
+ KContacts::Addressee realAddressee = converter.parseVCard( c );
// fix up the converted addressee for comparisson
convertedAddressee.setName( realAddressee.name() ); // name() apparently is something strange
@@ -313,27 +313,27 @@ void FormatTest::testDistlist()
QCOMPARE(reader.getVersion(), version);
QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug);
- KABC::ContactGroup convertedAddressee = reader.getDistlist();
+ KContacts::ContactGroup convertedAddressee = reader.getDistlist();
//Parse vcard
QFile vcardFile( vcardFileName );
QVERIFY( vcardFile.open( QFile::ReadOnly ) );
- KABC::VCardConverter converter;
+ KContacts::VCardConverter converter;
QByteArray c = vcardFile.readAll();
QBuffer data(&c);
data.open(QIODevice::ReadOnly);
- KABC::ContactGroup realAddressee;
- KABC::ContactGroupTool::convertFromXml( &data, realAddressee );
+ KContacts::ContactGroup realAddressee;
+ KContacts::ContactGroupTool::convertFromXml( &data, realAddressee );
{
QBuffer expected;
expected.open(QIODevice::WriteOnly);
- KABC::ContactGroupTool::convertToXml(realAddressee, &expected);
+ KContacts::ContactGroupTool::convertToXml(realAddressee, &expected);
QBuffer converted;
converted.open(QIODevice::WriteOnly);
- KABC::ContactGroupTool::convertToXml(convertedAddressee, &converted);
+ KContacts::ContactGroupTool::convertToXml(convertedAddressee, &converted);
showDiff(expected.buffer(), converted.buffer());
}
@@ -425,8 +425,8 @@ void FormatTest::generateMimefile()
// QFile vcardFile( getPath("v3/contacts/complex.vcf") );
// QVERIFY( vcardFile.open( QFile::ReadOnly ) );
-// KABC::VCardConverter converter;
-// const KABC::Addressee realAddressee = converter.parseVCard( vcardFile.readAll() );
+// KContacts::VCardConverter converter;
+// const KContacts::Addressee realAddressee = converter.parseVCard( vcardFile.readAll() );
//
// kDebug() << realAddressee.photo().data();
//
@@ -446,8 +446,8 @@ void FormatTest::generateVCard()
// Kolab::KolabObjectReader reader;
// Kolab::ObjectType t = reader.parseMimeMessage(msg);
//
-// KABC::Addressee convertedAddressee = reader.getContact();
-// KABC::VCardConverter converter;
+// KContacts::Addressee convertedAddressee = reader.getContact();
+// KContacts::VCardConverter converter;
// qDebug() << converter.createVCard(convertedAddressee);
// bool ok = false;
@@ -456,10 +456,10 @@ void FormatTest::generateVCard()
// Kolab::KolabObjectReader reader;
// Kolab::ObjectType t = reader.parseMimeMessage(msg);
//
-// KABC::ContactGroup convertedAddressee = reader.getDistlist();
+// KContacts::ContactGroup convertedAddressee = reader.getDistlist();
// QBuffer buf;
// buf.open(QIODevice::WriteOnly);
-// KABC::ContactGroupTool::convertToXml(convertedAddressee, &buf);
+// KContacts::ContactGroupTool::convertToXml(convertedAddressee, &buf);
// qDebug() << buf.buffer();
}
diff --git a/tests/formattest.h b/tests/formattest.h
index c69c261..5e894d7 100644
--- a/tests/formattest.h
+++ b/tests/formattest.h
@@ -21,7 +21,7 @@
#include <QObject>
/**
- * Test complete serialization from mime message to KCalCore/KABC containers.
+ * Test complete serialization from mime message to KCalCore/KContacts containers.
*
* The .ics .vcf files serve as reference, under the assumption that the iCal/vCard implementations don't have bugs.
*
diff --git a/tests/kcalconversiontest.cpp b/tests/kcalconversiontest.cpp
index c62a8e0..2b3fa73 100644
--- a/tests/kcalconversiontest.cpp
+++ b/tests/kcalconversiontest.cpp
@@ -23,7 +23,7 @@
#include <ksystemtimezone.h>
#include <kolabcontact.h>
#include <kcalcore/recurrence.h>
-#include <kabc/addressee.h>
+#include <kcontacts/addressee.h>
#include "conversion/kcalconversion.h"
#include "conversion/kcalconversion.cpp"
@@ -501,11 +501,11 @@ void KCalConversionTest::testJournalConversion()
void KCalConversionTest::testContactConversion_data()
{
- QTest::addColumn<KABC::Addressee>( "kcal" );
+ QTest::addColumn<KContacts::Addressee>( "kcal" );
QTest::addColumn<Kolab::Contact>( "kolab" );
{
- KABC::Addressee kcal;
+ KContacts::Addressee kcal;
kcal.setUid("uid");
kcal.setFormattedName("name");
@@ -516,7 +516,7 @@ void KCalConversionTest::testContactConversion_data()
QTest::newRow("basic") << kcal << kolab;
}
{
- KABC::Addressee kcal;
+ KContacts::Addressee kcal;
kcal.setUid("uid");
kcal.setFormattedName("name");
kcal.setBirthday(QDateTime(QDate(2012,2,2)));
@@ -530,7 +530,7 @@ void KCalConversionTest::testContactConversion_data()
QTest::newRow("bday") << kcal << kolab;
}
{
- KABC::Addressee kcal;
+ KContacts::Addressee kcal;
kcal.setUid("uid");
//The first address is always the preferred
kcal.setEmails(QStringList() << "email1@example.org" << "email2@example.org");
@@ -554,10 +554,10 @@ void KCalConversionTest::testContactConversion_data()
void KCalConversionTest::testContactConversion()
{
- QFETCH(KABC::Addressee, kcal);
+ QFETCH(KContacts::Addressee, kcal);
QFETCH(Kolab::Contact, kolab);
- const KABC::Addressee &e = toKABC(kolab);
+ const KContacts::Addressee &e = toKABC(kolab);
QCOMPARE(e.uid(), kcal.uid());
QCOMPARE(e.formattedName(), kcal.formattedName());
diff --git a/tests/testhelpers.h b/tests/testhelpers.h
index f0e3889..b0c00b7 100644
--- a/tests/testhelpers.h
+++ b/tests/testhelpers.h
@@ -26,7 +26,7 @@
#include <kcalcore/event.h>
#include <kcalcore/todo.h>
#include <kcalcore/journal.h>
-#include <kabc/addressee.h>
+#include <kcontacts/addressee.h>
#include <kolabformat.h>
@@ -45,14 +45,6 @@ Q_DECLARE_METATYPE(KCalCore::Event);
Q_DECLARE_METATYPE(KCalCore::Todo);
Q_DECLARE_METATYPE(KCalCore::Journal);
-#if KDEPIMLIBS_VERSION_MAJOR <= 4
-#if KDEPIMLIBS_VERSION_MINOR <= 11
-#if KDEPIMLIBS_VERSION_PATCH < 52
-Q_DECLARE_METATYPE(KCalCore::Duration);
-#endif
-#endif
-#endif
-
namespace QTest {
template<>
diff --git a/tests/testutils.h b/tests/testutils.h
index b118d86..6be04fd 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -142,18 +142,18 @@ static bool LexicographicalCompare( const T &_x, const T &_y )
return op( x.toString(), y.toString() );
}
-bool normalizePhoneNumbers( KABC::Addressee &addressee, KABC::Addressee &refAddressee )
+bool normalizePhoneNumbers( KContacts::Addressee &addressee, KContacts::Addressee &refAddressee )
{
- KABC::PhoneNumber::List phoneNumbers = addressee.phoneNumbers();
- KABC::PhoneNumber::List refPhoneNumbers = refAddressee.phoneNumbers();
+ 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::less, KABC::PhoneNumber> );
- std::sort( refPhoneNumbers.begin(), refPhoneNumbers.end(), LexicographicalCompare<std::less, KABC::PhoneNumber> );
+ std::sort( phoneNumbers.begin(), phoneNumbers.end(), LexicographicalCompare<std::less, KContacts::PhoneNumber> );
+ std::sort( refPhoneNumbers.begin(), refPhoneNumbers.end(), LexicographicalCompare<std::less, KContacts::PhoneNumber> );
for ( int i = 0; i < phoneNumbers.size(); ++i ) {
- KABC::PhoneNumber phoneNumber = phoneNumbers.at( i );
- const KABC::PhoneNumber refPhoneNumber = refPhoneNumbers.at( i );
+ KContacts::PhoneNumber phoneNumber = phoneNumbers.at( i );
+ const KContacts::PhoneNumber refPhoneNumber = refPhoneNumbers.at( i );
KCOMPARE( LexicographicalCompare<std::equal_to>( phoneNumber, refPhoneNumber ), true );
addressee.removePhoneNumber( phoneNumber );
phoneNumber.setId( refPhoneNumber.id() );
@@ -171,18 +171,18 @@ bool normalizePhoneNumbers( KABC::Addressee &addressee, KABC::Addressee &refAddr
return true;
}
-bool normalizeAddresses( KABC::Addressee &addressee, const KABC::Addressee &refAddressee )
+bool normalizeAddresses( KContacts::Addressee &addressee, const KContacts::Addressee &refAddressee )
{
- KABC::Address::List addresses = addressee.addresses();
- KABC::Address::List refAddresses = refAddressee.addresses();
+ 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::less, KABC::Address> );
- std::sort( refAddresses.begin(), refAddresses.end(), LexicographicalCompare<std::less, KABC::Address> );
+ std::sort( addresses.begin(), addresses.end(), LexicographicalCompare<std::less, KContacts::Address> );
+ std::sort( refAddresses.begin(), refAddresses.end(), LexicographicalCompare<std::less, KContacts::Address> );
for ( int i = 0; i < addresses.size(); ++i ) {
- KABC::Address address = addresses.at( i );
- const KABC::Address refAddress = refAddresses.at( i );
+ KContacts::Address address = addresses.at( i );
+ const KContacts::Address refAddress = refAddresses.at( i );
KCOMPARE( LexicographicalCompare<std::equal_to>( address, refAddress ), true );
addressee.removeAddress( address );
address.setId( refAddress.id() );
@@ -192,16 +192,16 @@ bool normalizeAddresses( KABC::Addressee &addressee, const KABC::Addressee &refA
return true;
}
-void normalizeContact(KABC::Addressee &addressee)
+void normalizeContact(KContacts::Addressee &addressee)
{
- KABC::Address::List addresses = addressee.addresses();
+ KContacts::Address::List addresses = addressee.addresses();
- foreach(KABC::Address a, addresses) {
+ foreach(KContacts::Address a, addresses) {
addressee.removeAddress(a);
a.setPostOfficeBox(QString()); //Not supported anymore
addressee.insertAddress(a);
}
- addressee.setSound(KABC::Sound()); //Sound is not supported
+ addressee.setSound(KContacts::Sound()); //Sound is not supported
addressee.removeCustom("KOLAB", "CreationDate"); //The creation date is no longer existing
diff --git a/tests/upgradetest.cpp b/tests/upgradetest.cpp
index 0e943ac..f32985e 100644
--- a/tests/upgradetest.cpp
+++ b/tests/upgradetest.cpp
@@ -27,7 +27,7 @@
#include "kolabformat/kolabobject.h"
#include <conversion/commonconversion.h>
#include <kcalcore/icalformat.h>
-#include <kabc/vcardconverter.h>
+#include <kcontacts/vcardconverter.h>
void UpgradeTest::testIncidence_data()
{
@@ -157,7 +157,7 @@ void UpgradeTest::testContact()
QCOMPARE(reader.getVersion(), Kolab::KolabV2);
QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug);
- KABC::Addressee v2Addressee = reader.getContact();
+ KContacts::Addressee v2Addressee = reader.getContact();
QVERIFY(!v2Addressee.isEmpty());
//Write
@@ -166,14 +166,14 @@ void UpgradeTest::testContact()
//load V3
Kolab::KolabObjectReader reader2;
QCOMPARE(reader2.parseMimeMessage(v3message), type);
- KABC::Addressee v3result = reader2.getContact();
+ KContacts::Addressee v3result = reader2.getContact();
QVERIFY(!v3result.isEmpty());
normalizeContact(v2Addressee);
QVERIFY( normalizePhoneNumbers( v3result, v2Addressee ) ); // phone number ids are random
QVERIFY( normalizeAddresses( v3result, v2Addressee ) ); // same here
- KABC::VCardConverter converter;
+ KContacts::VCardConverter converter;
if ( v2Addressee != v3result ) {
showDiff(converter.createVCard(v2Addressee), converter.createVCard(v3result));
QVERIFY( false );