Branch 'files' - 2 commits - schemas/kolabformat.xsd src/containers src/kolabconversions.h tests/bindingstest.cpp
Christian Mollekopf
mollekopf at kolabsys.com
Fri Nov 2 00:40:29 CET 2012
schemas/kolabformat.xsd | 2 +-
src/containers/kolabfile.cpp | 6 +++---
src/containers/kolabfile.h | 4 ++--
src/kolabconversions.h | 12 +++++++++---
tests/bindingstest.cpp | 4 ++--
5 files changed, 17 insertions(+), 11 deletions(-)
New commits:
commit 3f281f354248eb90694af82f344021f5c27e6f9f
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Fri Nov 2 00:37:54 2012 +0100
Renamed the attachment property to file, to stress the difference between the xcal attachment property and this one.
diff --git a/schemas/kolabformat.xsd b/schemas/kolabformat.xsd
index 56ed6b8..0e8c8d8 100644
--- a/schemas/kolabformat.xsd
+++ b/schemas/kolabformat.xsd
@@ -86,7 +86,7 @@
<xs:element name="last-modification-date" type="xs:dateTime"/>
<xs:element name="categories" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="classification" type="classifcationPropType" minOccurs="0" />
- <xs:element name="attachment" type="attachmentPropType" />
+ <xs:element name="file" type="attachmentPropType" />
<xs:element name="note" type="xs:string" minOccurs="0" />
<xs:element name="x-custom" type="CustomType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
diff --git a/src/containers/kolabfile.cpp b/src/containers/kolabfile.cpp
index 556ef04..cc4ec8e 100644
--- a/src/containers/kolabfile.cpp
+++ b/src/containers/kolabfile.cpp
@@ -64,7 +64,7 @@ bool File::operator==(const Kolab::File& other) const
d->categories == other.categories() &&
d->classification == other.classification() &&
d->note == other.note() &&
- d->attachment == other.attachment() &&
+ d->attachment == other.file() &&
d->customProperties == other.customProperties());
}
@@ -138,12 +138,12 @@ std::string File::note() const
return d->note;
}
-void File::setAttachment(const Attachment &attach)
+void File::setFile(const Attachment &attach)
{
d->attachment = attach;
}
-Attachment File::attachment() const
+Attachment File::file() const
{
return d->attachment;
}
diff --git a/src/containers/kolabfile.h b/src/containers/kolabfile.h
index 90e7750..767893e 100644
--- a/src/containers/kolabfile.h
+++ b/src/containers/kolabfile.h
@@ -53,8 +53,8 @@ namespace Kolab {
void setNote(const std::string &);
std::string note() const;
- void setAttachment(const Attachment &);
- Attachment attachment() const;
+ void setFile(const Attachment &);
+ Attachment file() const;
void setCustomProperties(const std::vector<CustomProperty> &);
std::vector<CustomProperty> customProperties() const;
diff --git a/src/kolabconversions.h b/src/kolabconversions.h
index 583f56f..3fffa1b 100644
--- a/src/kolabconversions.h
+++ b/src/kolabconversions.h
@@ -295,7 +295,7 @@ std::string serializeObject <Kolab::File> (const Kolab::File &file, const std::s
ERROR("missing filename");
}
- KolabXSD::File n(uid, getProductId(prod), created, lastModificationDate, fromAttachment(file.attachment()));
+ KolabXSD::File n(uid, getProductId(prod), created, lastModificationDate, fromAttachment(file.file()));
if (!file.categories().empty()) {
KolabXSD::File::categories_sequence categories;
@@ -549,14 +549,14 @@ boost::shared_ptr<Kolab::File> deserializeObject <Kolab::File> (const std::strin
}
}
- const Kolab::Attachment &attachment = toAttachment(file->attachment());
+ const Kolab::Attachment &attachment = toAttachment(file->file());
if (attachment.label().empty()) {
ERROR("Missing filename");
}
if (!attachment.isValid()) {
ERROR("invalid attachment");
}
- n->setAttachment(attachment);
+ n->setFile(attachment);
if (file->note()) {
n->setNote(*file->note());
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index 5b5e196..468bce9 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -128,7 +128,7 @@ void BindingsTest::fileCompletness()
Kolab::Attachment attachment;
attachment.setData("data", "mimetype");
attachment.setLabel("label");
- file.setAttachment(attachment);
+ file.setFile(attachment);
const std::string &result = Kolab::writeFile(file);
QCOMPARE(Kolab::error(), Kolab::NoError);
@@ -142,7 +142,7 @@ void BindingsTest::fileCompletness()
QCOMPARE(re.classification(), file.classification());
QCOMPARE(re.categories(), file.categories());
QCOMPARE(re.note(), file.note());
- QCOMPARE(re.attachment(), file.attachment());
+ QCOMPARE(re.file(), file.file());
}
commit 95061b30ccc2e63e162e3510e6de5c0292c0a7dd
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Fri Nov 2 00:36:31 2012 +0100
Made the filename mandatory.
diff --git a/src/kolabconversions.h b/src/kolabconversions.h
index 210cd20..583f56f 100644
--- a/src/kolabconversions.h
+++ b/src/kolabconversions.h
@@ -291,6 +291,9 @@ std::string serializeObject <Kolab::File> (const Kolab::File &file, const std::s
// WARNING("missing last_modification_date, fallback to current timestamp");
lastModificationDate = fromDateTime(timestamp());
}
+ if (file.file().label().empty()) {
+ ERROR("missing filename");
+ }
KolabXSD::File n(uid, getProductId(prod), created, lastModificationDate, fromAttachment(file.attachment()));
@@ -547,6 +550,9 @@ boost::shared_ptr<Kolab::File> deserializeObject <Kolab::File> (const std::strin
}
const Kolab::Attachment &attachment = toAttachment(file->attachment());
+ if (attachment.label().empty()) {
+ ERROR("Missing filename");
+ }
if (!attachment.isValid()) {
ERROR("invalid attachment");
}
More information about the commits
mailing list