diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2014-03-21 16:30:45 (GMT) |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2014-03-21 16:30:45 (GMT) |
commit | 0580ae5453f84544a1880ed1256bd524ff5f6c9b (patch) | |
tree | 8834401bcfc554154586ac8562ff1f66d6cad068 | |
parent | a8968196c72913fd38e875667f7a5ce68e31a0d8 (diff) | |
download | libkolabxml-0580ae5453f84544a1880ed1256bd524ff5f6c9b.tar.gz |
Made attachment mimetype optional.
-rw-r--r-- | src/containers/kolabcontainers.cpp | 6 | ||||
-rw-r--r-- | src/xcalconversions.h | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/containers/kolabcontainers.cpp b/src/containers/kolabcontainers.cpp index 47c76e3..fc241a1 100644 --- a/src/containers/kolabcontainers.cpp +++ b/src/containers/kolabcontainers.cpp @@ -536,11 +536,13 @@ struct Attachment::Private std::string data; std::string mimetype; std::string label; + bool isValid; }; Attachment::Attachment() : d(new Attachment::Private) { + d->isValid = false; } Attachment::Attachment(const Kolab::Attachment &other) @@ -568,6 +570,7 @@ bool Attachment::operator==(const Kolab::Attachment &other) const void Attachment::setUri(const std::string &uri, const std::string& mimetype) { + d->isValid = true; d->uri = uri; d->mimetype = mimetype; } @@ -594,6 +597,7 @@ std::string Attachment::label() const void Attachment::setData(const std::string &data, const std::string& mimetype) { + d->isValid = true; d->data = data; d->mimetype = mimetype; } @@ -605,7 +609,7 @@ std::string Attachment::data() const bool Attachment::isValid() const { - return !d->mimetype.empty(); //TODO use isValid variable + return d->isValid; } diff --git a/src/xcalconversions.h b/src/xcalconversions.h index 9326548..923646b 100644 --- a/src/xcalconversions.h +++ b/src/xcalconversions.h @@ -417,16 +417,13 @@ Kolab::Attachment toAttachment(T aProp) } } } - if (mimetype.empty()) { - ERROR("no mimetype"); - } if (aProp.uri()) { a.setUri(*aProp.uri(), mimetype); } else if (aProp.binary()) { a.setData(base64_decode(*aProp.binary()), mimetype); } else { - ERROR("not uri and no data available"); + ERROR("no uri and no data available"); } return a; } |