CMakeLists.txt kolabformat/kolabobject.cpp kolabformat/kolabobject.h libkolab_config.h.in

Christian Mollekopf mollekopf at kolabsys.com
Mon Nov 10 10:39:57 CET 2014


 CMakeLists.txt              |    1 +
 kolabformat/kolabobject.cpp |   24 +++++++++++++++---------
 kolabformat/kolabobject.h   |    6 +++++-
 libkolab_config.h.in        |    2 ++
 4 files changed, 23 insertions(+), 10 deletions(-)

New commits:
commit 0c06b90ec66255285327798d1436e14144765b7f
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon Nov 10 10:39:45 2014 +0100

    Compile without akonadi/relation.h if tag.h is available.
    
    Which is the situation in upstream.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1baa147..10ef309 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,6 +127,7 @@ set(CMAKE_REQUIRED_INCLUDES "/opt/devel/kolab/include/")
 #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)
diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index 4a9fc5e..9aed0b7 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -166,8 +166,10 @@ public:
     Version mOverrideVersion;
     bool mDoOverrideVersion;
 
-#ifdef HAVE_TAG_H
+#ifdef HAVE_RELATION_H
     Akonadi::Relation mRelation;
+#endif
+#ifdef HAVE_TAG_H
     Akonadi::Tag mTag;
     QStringList mTagMembers;
 #endif
@@ -428,6 +430,7 @@ 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());
@@ -438,6 +441,7 @@ 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);
@@ -577,24 +581,26 @@ bool KolabObjectReader::isTag() const
     return d->mTag.isValid();
 }
 
-bool KolabObjectReader::isRelation() const
+Akonadi::Tag KolabObjectReader::getTag() const
 {
-    return d->mRelation.isValid();
+    return d->mTag;
 }
 
-Akonadi::Relation KolabObjectReader::getRelation() const
+QStringList KolabObjectReader::getTagMembers() const
 {
-    return d->mRelation;
+    return d->mTagMembers;
 }
+#endif
 
-Akonadi::Tag KolabObjectReader::getTag() const
+#ifdef HAVE_RELATION_H
+bool KolabObjectReader::isRelation() const
 {
-    return d->mTag;
+    return d->mRelation.isValid();
 }
 
-QStringList KolabObjectReader::getTagMembers() const
+Akonadi::Relation KolabObjectReader::getRelation() const
 {
-    return d->mTagMembers;
+    return d->mRelation;
 }
 #endif
 
diff --git a/kolabformat/kolabobject.h b/kolabformat/kolabobject.h
index 9bb3762..bc6d6e2 100644
--- a/kolabformat/kolabobject.h
+++ b/kolabformat/kolabobject.h
@@ -25,6 +25,8 @@
 #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>
@@ -109,9 +111,11 @@ public:
 #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;
-    QStringList getTagMembers() const;
 #endif
 
 private:
diff --git a/libkolab_config.h.in b/libkolab_config.h.in
index 46b59ea..7cf8522 100644
--- a/libkolab_config.h.in
+++ b/libkolab_config.h.in
@@ -2,3 +2,5 @@
 
 /* Whether akonadi/tag.h exists. */
 #cmakedefine HAVE_TAG_H 1
+/* Whether akonadi/relation.h exists. */
+#cmakedefine HAVE_RELATION_H 1




More information about the commits mailing list