summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2014-11-12 13:04:50 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2014-11-12 13:04:50 (GMT)
commit65e0a054fb74a5d04ca991dbd6b8f50fd6c798a9 (patch)
tree33e6697d1f56dbf0245115be482eea9641f5236d
parente6cee1d7b304036ab7599283e749425b1ad2bbac (diff)
downloadlibkolab-65e0a054fb74a5d04ca991dbd6b8f50fd6c798a9.tar.gz
Store relationmembers in tagmembers as well.
-rw-r--r--kolabformat/kolabobject.cpp18
-rw-r--r--kolabformat/kolabobject.h2
2 files changed, 14 insertions, 6 deletions
diff --git a/kolabformat/kolabobject.cpp b/kolabformat/kolabobject.cpp
index 65918d1..d6e5173 100644
--- a/kolabformat/kolabobject.cpp
+++ b/kolabformat/kolabobject.cpp
@@ -435,8 +435,11 @@ ObjectType KolabObjectReader::Private::readKolabV3(const KMime::Message::Ptr &ms
mRelation = Akonadi::Relation();
mRelation.setRemoteId(Conversion::fromStdString(configuration.uid()).toLatin1());
mRelation.setType(Akonadi::Relation::GENERIC);
- mRelation.setLeft(Akonadi::Item(Conversion::fromStdString(relation.members()[0]).toLongLong()));
- mRelation.setRight(Akonadi::Item(Conversion::fromStdString(relation.members()[1]).toLongLong()));
+
+ mTagMembers.reserve(relation.members().size());
+ foreach (const std::string &member, relation.members()) {
+ mTagMembers << Conversion::fromStdString(member);
+ }
} else {
Critical() << "generic relation had wrong number of members:" << relation.members().size();
printMessageDebugInfo(msg);
@@ -812,18 +815,23 @@ KMime::Message::Ptr KolabObjectWriter::writeTag(const Akonadi::Tag &tag, const Q
#endif
#ifdef HAVE_RELATION_H
-KMime::Message::Ptr KolabObjectWriter::writeRelation(const Akonadi::Relation &relation, Version v, const QString &productId)
+KMime::Message::Ptr KolabObjectWriter::writeRelation(const Akonadi::Relation &relation, const QStringList &items, Version v, const QString &productId)
{
ErrorHandler::clearErrors();
if (v != KolabV3) {
Critical() << "only v3 implementation available";
}
+ if (items.size() != 2) {
+ Critical() << "Wrong number of members for generic relation.";
+ return KMime::Message::Ptr();
+ }
+
Kolab::Relation kolabRelation(std::string(), "generic");
std::vector<std::string> m;
m.reserve(2);
- m.push_back(Conversion::toStdString(QString::number(relation.left().id())));
- m.push_back(Conversion::toStdString(QString::number(relation.right().id())));
+ m.push_back(Conversion::toStdString(items.at(0)));
+ m.push_back(Conversion::toStdString(items.at(1)));
kolabRelation.setMembers(m);
return writeRelationHelper(kolabRelation, relation.remoteId(), productId);
diff --git a/kolabformat/kolabobject.h b/kolabformat/kolabobject.h
index 378a172..96a6575 100644
--- a/kolabformat/kolabobject.h
+++ b/kolabformat/kolabobject.h
@@ -145,7 +145,7 @@ public:
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 &, Version v = KolabV3, const QString &productId = QString());
+ static KMime::Message::Ptr writeRelation(const Akonadi::Relation &, const QStringList &items, Version v = KolabV3, const QString &productId = QString());
#endif
};