Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
18 KB
Referenced Files
None
Subscribers
None
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae6c684..6f24001 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,211 +1,213 @@
project(Libkolab)
cmake_minimum_required(VERSION 2.6.4)
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 )
set(Libkolab_MODULE_DIR ${Libkolab_SOURCE_DIR}/cmake/modules)
set(CMAKE_MODULE_PATH ${Libkolab_MODULE_DIR})
# only available from cmake-2.8.0
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 7)
cmake_policy(SET CMP0012 NEW)
endif()
# only available from cmake-2.8.4
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 7 AND
${CMAKE_PATCH_VERSION} GREATER 3)
cmake_policy(SET CMP0017 NEW)
endif()
# Versioning
# x.y.z scheme
# Development versions are only x.y
#
# i.e.
# 0.1 (0.1 development version towards 0.1.0)
# 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 5)
# 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_STRING ${CMAKE_PROJECT_NAME}-${Libkolab_VERSION})
# set up install directories.
set(LIB_INSTALL_DIR lib 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 )
# Make relative paths absolute (needed later on)
foreach(p LIB INCLUDE CMAKECONFIG)
set(var ${p}_INSTALL_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
include(MacroLogFeature)
# Do the building
find_package(Libkolabxml 1.0 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)
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)
endif()
find_package(SWIG)
#Show summary of found libraries
macro_display_feature_log()
-# add_definitions(-DKDEPIMLIBS_VERSION=0x${KdepimLibs_VERSION_MAJOR}0${KdepimLibs_VERSION_MINOR}${KDEPIMLIBS_VERSION_PATCH})
# 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()
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-check-new -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -fexceptions -UQT_NO_EXCEPTIONS -fPIC -g" )
# 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_INCLUDE_DIR})
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()
find_package(Boost REQUIRED)
include_directories(
${QT_INCLUDES}
${KDE_INCLUDES}
${CMAKE_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/kolabformatV2
${Libkolabxml_INCLUDES}
./
)
configure_file(libkolab-version.h.cmake "${CMAKE_BINARY_DIR}/libkolab-version.h" @ONLY)
add_subdirectory(kolabformatV2)
add_subdirectory(conversion)
add_subdirectory(calendaring)
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)
set(KOLAB_SRCS
kolabformat/kolabobject.cpp
kolabformat/xmlobject.cpp
kolabformat/formathelpers.cpp
kolabformat/errorhandler.cpp
kolabformat/v2helpers.cpp
kolabformat/mimeobject.cpp
mime/mimeutils.cpp
${CONVERSION_SRCS}
${kolabformatv2_SRCS}
${CALENDARING_SRCS}
${ICALENDAR_SRCS}
${CALENDARING_MOC}
${CONVERSION_MOC}
${FREEBUSY_SRCS}
)
set(KOLAB_LINK_LIBRARIES
${Libkolabxml_LIBRARIES}
${QT_QTCORE_LIBRARY}
${QT_QTXML_LIBRARY}
${QT_QTGUI_LIBRARY}
${KDE_LIBRARIES}
)
if(BUILD_TESTS)
#for tests only
enable_testing()
add_library(kolab_static STATIC ${KOLAB_SRCS})
target_link_libraries(kolab_static ${KOLAB_LINK_LIBRARIES})
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} )
install(TARGETS kolab EXPORT LibkolabExport
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
install(FILES
kolab_export.h
kolabformat/kolabdefinitions.h
kolabformat/formathelpers.h
kolabformat/kolabobject.h
kolabformat/errorhandler.h
kolabformat/xmlobject.h
kolabformat/mimeobject.h
conversion/kcalconversion.h
conversion/kabcconversion.h
conversion/commonconversion.h
freebusy/freebusy.h
DESTINATION ${INCLUDE_INSTALL_DIR}
)
#Get the include directory relative to CMAKECONFIG_INSTALL_DIR
file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKECONFIG_INSTALL_DIR}" "${INCLUDE_INSTALL_DIR}")
#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 )
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} )
include(SWIGUtils)
if(PYTHON_BINDINGS)
generatePythonBindings(shared shared.i)
add_subdirectory(kolabformat/python)
endif(PYTHON_BINDINGS)
if(PHP_BINDINGS)
generatePHPBindings(kolabshared shared.i)
add_subdirectory(kolabformat/php)
endif(PHP_BINDINGS)
diff --git a/tests/testhelpers.h b/tests/testhelpers.h
index 84a2e46..546bc30 100644
--- a/tests/testhelpers.h
+++ b/tests/testhelpers.h
@@ -1,310 +1,317 @@
/*
* Copyright (C) 2012 Christian Mollekopf <mollekopf@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TESTHELPERS_H
#define TESTHELPERS_H
#include <contact.h>
#include <QtCore/QObject>
#include <QtTest/QtTest>
#include <kcalcore/recurrence.h>
#include <kcalcore/event.h>
#include <kcalcore/todo.h>
#include <kcalcore/journal.h>
#include <kabc/addressee.h>
#include <kolabformat.h>
Q_DECLARE_METATYPE(Kolab::Duration);
Q_DECLARE_METATYPE(Kolab::cDateTime);
Q_DECLARE_METATYPE(std::vector<Kolab::cDateTime>);
Q_DECLARE_METATYPE(Kolab::Event);
Q_DECLARE_METATYPE(std::vector<Kolab::Event>);
Q_DECLARE_METATYPE(Kolab::Todo);
Q_DECLARE_METATYPE(Kolab::Journal);
Q_DECLARE_METATYPE(Kolab::Contact);
Q_DECLARE_METATYPE(Kolab::Period);
Q_DECLARE_METATYPE(std::vector<Kolab::FreebusyPeriod>);
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<>
char *toString(const Kolab::cDateTime &dt)
{
QByteArray ba = "Kolab::cDateTime(";
ba += QByteArray::number(dt.year()) + ", " + QByteArray::number(dt.month())+ ", " + QByteArray::number(dt.day()) + ", ";
ba += QByteArray::number(dt.hour()) + ", " + QByteArray::number(dt.minute()) + ", " + QByteArray::number(dt.second())+ ", ";
ba += QString(dt.isUTC()?QString("UTC"):QString("TZ: "+QString::fromStdString(dt.timezone()))).toAscii();
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const KDateTime &dt)
{
QByteArray ba = "KDateTime(";
ba += dt.toString().toAscii();
ba += dt.timeZone().name();
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const KCalCore::Attendee &at)
{
QByteArray ba = "Attendee(";
ba += at.name().toAscii() + ", ";
ba += at.email().toAscii() + ", ";
ba += QString::number(at.role()) + ", ";
ba += QString::number(at.status()) + ", ";
ba += QString::number(at.RSVP()) + ", ";
ba += at.delegate().toAscii() + ", ";
ba += at.delegator().toAscii() + ", ";
ba += at.uid().toAscii() + ", ";
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const QList<int> &l)
{
QByteArray ba = "QList<int>(";
foreach(int i, l) {
ba += QString::number(i) + ", ";
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const QList<KCalCore::RecurrenceRule::WDayPos> &l)
{
QByteArray ba = "QList<int>(";
foreach(const KCalCore::RecurrenceRule::WDayPos &i, l) {
ba += QString::number(i.pos()) + " ";
ba += QString::number(i.day()) + ", ";
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const KCalCore::DateList &l)
{
QByteArray ba = "KCalCore::DateList(";
foreach(const QDate &i, l) {
ba += i.toString();
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const KCalCore::DateTimeList &l)
{
QByteArray ba = "KCalCore::DateTimeList(";
foreach(const KDateTime &i, l) {
ba += toString(i);
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const KCalCore::Recurrence &at)
{
at.dump();
KCalCore::RecurrenceRule *r = at.defaultRRule();
QByteArray ba;
if (!r) {
ba += "Recurrence( )";
} else {
Q_ASSERT(r);
Q_ASSERT(at.rRules().size() == 1);
ba += "Recurrence(";
ba += QString::number(r->recurrenceType()) + "\n";
ba += QString::number(r->frequency()) + "\n";
ba += QString::number(r->duration()) + "\n";
ba += QByteArray(toString(r->startDt())) + "\n";
ba += QByteArray(toString(r->endDt())) + "\n";
ba += QByteArray(toString(r->bySeconds())) + "\n";
ba += QByteArray(toString(r->byMinutes())) + "\n";
ba += QByteArray(toString(r->byHours())) + "\n";
ba += QByteArray(toString(r->byDays())) + "\n";
ba += QByteArray(toString(r->byMonthDays())) + "\n";
ba += QByteArray(toString(r->byYearDays())) + "\n";
ba += QByteArray(toString(r->byMonths())) + "\n";
ba += ")\n";
ba += QByteArray(toString(at.exDates())) + "\n";
ba += QByteArray(toString(at.exDateTimes())) + "\n";
ba += QByteArray(toString(at.rDates())) + "\n";
ba += QByteArray(toString(at.rDateTimes())) + "\n";
}
return qstrdup(ba.data());
}
template<>
char *toString(const Kolab::RecurrenceRule &at)
{
QByteArray ba;
ba += "KolabRecurrenceRule(";
ba += QString::number(at.weekStart()) + "\n";
ba += QString::number(at.frequency()) + "\n";
ba += QString::number(at.interval()) + "\n";
ba += QString::number(at.count()) + "\n";
ba += QByteArray(toString(at.end())) + "\n";
ba += QByteArray(toString(at.bysecond())) + "\n";
ba += QByteArray(toString(at.byminute())) + "\n";
ba += QByteArray(toString(at.byhour())) + "\n";
ba += QByteArray(toString(at.byday())) + "\n";
ba += QByteArray(toString(at.bymonthday())) + "\n";
ba += QByteArray(toString(at.byyearday())) + "\n";
ba += QByteArray(toString(at.byweekno())) + "\n";
ba += QByteArray(toString(at.bymonth())) + "\n";
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const KCalCore::Duration &d)
{
QByteArray ba;
ba += "KCalCore::Duration(";
ba += QString::number(d.isDaily()) + ", ";
ba += QString::number(d.value()) + " ";
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const Kolab::ContactReference &a)
{
QByteArray ba = "Kolab::ContactReference(";
ba += QString::fromStdString(a.email()).toAscii()+ ", ";
ba += QString::fromStdString(a.name()).toAscii()+ ", ";
ba += QString::fromStdString(a.uid()).toAscii();
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const std::vector<Kolab::ContactReference> &v)
{
QByteArray ba = "vector<Kolab::ContactReference>(";
for (std::size_t i = 0; i < v.size(); i++) {
ba += QByteArray(toString(v.at(i)))+ "\n";
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const Kolab::Attendee &a)
{
QByteArray ba = "Kolab::Attendee(";
ba += QString::fromStdString(a.contact().email()).toAscii() + "\n";
ba += QString::fromStdString(a.contact().name()).toAscii()+ "\n";
ba += QByteArray::number(a.partStat()) + "\n";
ba += QByteArray::number(a.role()) + "\n";
ba += QByteArray::number(a.rsvp()) + "\n";
ba += QString::fromStdString(a.contact().uid()).toAscii()+"\n";
ba += QByteArray(toString(a.delegatedTo()))+"\n";
ba += QByteArray(toString(a.delegatedFrom()))+ "\n";
ba += QByteArray::number(a.cutype())+ "\n";
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const std::vector<Kolab::Attendee> &v)
{
QByteArray ba = "vector<Kolab::Attendee>(";
for (std::size_t i = 0; i < v.size(); i++) {
ba += QByteArray(toString(v.at(i)))+ "\n";
ba += QByteArray("#######################")+ "\n";
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const Kolab::CustomProperty &a)
{
QByteArray ba = "Kolab::CustomProperty(";
ba += QString::fromStdString(a.identifier).toAscii()+ ", ";
ba += QString::fromStdString(a.value).toAscii();
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const std::vector<Kolab::CustomProperty> &v)
{
QByteArray ba = "vector<Kolab::CustomProperty>(";
for (std::size_t i = 0; i < v.size(); i++) {
ba += QByteArray(toString(v.at(i)))+ "\n";
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const Kolab::Period &p)
{
QByteArray ba = "Kolab::Period(";
ba += QByteArray(toString(p.start))+ "\n";
ba += QByteArray(toString(p.end))+ "\n";
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const std::vector<Kolab::Period> &v)
{
QByteArray ba = "vector<Kolab::Period>(";
for (std::size_t i = 0; i < v.size(); i++) {
ba += QByteArray(toString(v.at(i)))+ "\n";
}
ba += ")";
return qstrdup(ba.data());
}
template<>
char *toString(const Kolab::FreebusyPeriod &p)
{
QByteArray ba = "Kolab::FreebusyPeriod(";
ba += QString::number(p.type())+ "\n";
ba += QString::fromStdString(p.eventUid())+ "\n";
ba += QString::fromStdString(p.eventLocation())+ "\n";
ba += QString::fromStdString(p.eventSummary())+ "\n";
ba += QByteArray(toString(p.periods()))+ "\n";
ba += ")";
return qstrdup(ba.data());
}
}
#endif

File Metadata

Mime Type
text/x-diff
Expires
Fri, Apr 24, 10:25 AM (1 d, 11 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18814014
Default Alt Text
(18 KB)

Event Timeline