diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-04 11:29:32 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-04 11:29:32 +0100 |
commit | d2305f14fced3afdbda2b5a8f2a270ae91d79ae1 (patch) | |
tree | b05f72eb639798dc8b1eadd0afc4209f7a2158cb /common/propertymapper.cpp | |
parent | 0f75ad4b96ec5994c022109278cad28a43255793 (diff) | |
download | sink-d2305f14fced3afdbda2b5a8f2a270ae91d79ae1.tar.gz sink-d2305f14fced3afdbda2b5a8f2a270ae91d79ae1.zip |
Added mail and folder properties
Diffstat (limited to 'common/propertymapper.cpp')
-rw-r--r-- | common/propertymapper.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/common/propertymapper.cpp b/common/propertymapper.cpp index 7ff072a..60f7dd5 100644 --- a/common/propertymapper.cpp +++ b/common/propertymapper.cpp | |||
@@ -29,6 +29,15 @@ flatbuffers::uoffset_t variantToProperty<QString>(const QVariant &property, flat | |||
29 | } | 29 | } |
30 | 30 | ||
31 | template <> | 31 | template <> |
32 | flatbuffers::uoffset_t variantToProperty<QByteArray>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb) | ||
33 | { | ||
34 | if (property.isValid()) { | ||
35 | return fbb.CreateString(property.toByteArray().toStdString()).o; | ||
36 | } | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | template <> | ||
32 | QVariant propertyToVariant<QString>(const flatbuffers::String *property) | 41 | QVariant propertyToVariant<QString>(const flatbuffers::String *property) |
33 | { | 42 | { |
34 | if (property) { | 43 | if (property) { |
@@ -39,8 +48,17 @@ QVariant propertyToVariant<QString>(const flatbuffers::String *property) | |||
39 | } | 48 | } |
40 | 49 | ||
41 | template <> | 50 | template <> |
51 | QVariant propertyToVariant<QByteArray>(const flatbuffers::String *property) | ||
52 | { | ||
53 | if (property) { | ||
54 | //We have to copy the memory, otherwise it would become eventually invalid | ||
55 | return QString::fromStdString(property->c_str()).toUtf8(); | ||
56 | } | ||
57 | return QVariant(); | ||
58 | } | ||
59 | |||
60 | template <> | ||
42 | QVariant propertyToVariant<bool>(uint8_t property) | 61 | QVariant propertyToVariant<bool>(uint8_t property) |
43 | { | 62 | { |
44 | return static_cast<bool>(property); | 63 | return static_cast<bool>(property); |
45 | } | 64 | } |
46 | |||