CMakeLists.txt kolabformat/kolabobject.cpp kolabformat/kolabobject.h
Christian Mollekopf
mollekopf at kolabsys.com
Wed Sep 24 09:48:51 CEST 2014
CMakeLists.txt | 12 +++++++++++-
kolabformat/kolabobject.cpp | 12 ++++++++++--
kolabformat/kolabobject.h | 8 ++++++++
3 files changed, 29 insertions(+), 3 deletions(-)
New commits:
commit b3c3a23bd7a8fb379557c37c5665db58a95d37a2
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Wed Sep 24 09:48:37 2014 +0200
Compile the part of libkolab that depends on tag.h conditionally.
I had to include KDE4_INCLUDES to make sure includes/KDE is included for
the #include <KUrl> in tag.h.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89a555a..633f1af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,7 +91,7 @@ if (USE_LIBCALENDARING)
set( KDE_LIBRARIES ${Libcalendaring_LIBRARIES} )
message("${Libcalendaring_INCLUDE_DIRS} ${Libcalendaring_LIBRARIES}")
else()
- set( KDE_INCLUDES ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDE_DIR})
+ set( KDE_INCLUDES ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} )
set( KDE_LIBRARIES
${KDEPIMLIBS_KCALCORE_LIBS}
${KDEPIMLIBS_KABC_LIBS}
@@ -119,6 +119,16 @@ 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)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
add_subdirectory(kolabformatV2)
add_subdirectory(conversion)
add_subdirectory(calendaring)
diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index 90b4e78..3d41c5c 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -70,12 +70,12 @@ RelationMember parseMemberUrl(const QString &string)
// qDebug() << path;
int start = path.indexOf("user");
if (start < 0) {
- kWarning() << "Couldn't find \"user\" in path: " << path;
+ Warning() << "Couldn't find \"user\" in path: " << path;
return RelationMember();
}
path = path.mid(start + 1);
if (path.size() < 2) {
- kWarning() << "Incomplete path: " << path;
+ Warning() << "Incomplete path: " << path;
return RelationMember();
}
// user-name
@@ -144,8 +144,10 @@ public:
ObjectType mObjectType;
Version mVersion;
Kolab::Freebusy mFreebusy;
+#ifdef HAVE_TAG_H
Akonadi::Tag mTag;
QStringList mTagMembers;
+#endif
ObjectType mOverrideObjectType;
Version mOverrideVersion;
bool mDoOverrideVersion;
@@ -390,6 +392,7 @@ 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();
@@ -406,6 +409,7 @@ ObjectType KolabObjectReader::Private::readKolabV3(const KMime::Message::Ptr &ms
}
break;
+#endif
default:
Critical() << "no kolab object found ";
printMessageDebugInfo(msg);
@@ -532,6 +536,7 @@ Freebusy KolabObjectReader::getFreebusy() const
return d->mFreebusy;
}
+#ifdef HAVE_TAG_H
Akonadi::Tag KolabObjectReader::getTag() const
{
return d->mTag;
@@ -541,6 +546,7 @@ QStringList KolabObjectReader::getTagMembers() const
{
return d->mTagMembers;
}
+#endif
//Normalize incidences before serializing them
@@ -720,6 +726,7 @@ 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 KolabObjectWriter::writeTag(const Akonadi::Tag &tag, const QStringList &members, Version v, const QString &productId)
{
ErrorHandler::clearErrors();
@@ -741,6 +748,7 @@ KMime::Message::Ptr KolabObjectWriter::writeTag(const Akonadi::Tag &tag, const Q
ErrorHandler::handleLibkolabxmlErrors();
return Mime::createMessage(Conversion::fromStdString(configuration.uid()), kolabMimeType(), relationKolabType(), Conversion::fromStdString(v3String).toUtf8(), true, getProductId(productId));
}
+#endif
diff --git a/kolabformat/kolabobject.h b/kolabformat/kolabobject.h
index 71a0e4b..48f83d7 100644
--- a/kolabformat/kolabobject.h
+++ b/kolabformat/kolabobject.h
@@ -20,7 +20,11 @@
#include <kolab_export.h>
+#include "config.h"
+
+#ifdef HAVE_TAG_H
#include <akonadi/tag.h>
+#endif
#include <kabc/addressee.h>
#include <kabc/contactgroup.h>
#include <kcalcore/incidence.h>
@@ -99,8 +103,10 @@ public:
KMime::Message::Ptr getNote() const;
QStringList getDictionary(QString &lang) const;
Freebusy getFreebusy() const;
+#ifdef HAVE_TAG_H
Akonadi::Tag getTag() const;
QStringList getTagMembers() const;
+#endif
private:
//@cond PRIVATE
@@ -125,7 +131,9 @@ public:
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
};
More information about the commits
mailing list