Changeset View
Changeset View
Standalone View
Standalone View
src/core/tag.cpp
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | 139 | { | |||
---|---|---|---|---|---|
140 | return d_ptr->mAttributeStorage.attributes(); | 140 | return d_ptr->mAttributeStorage.attributes(); | ||
141 | } | 141 | } | ||
142 | 142 | | |||
143 | void Tag::clearAttributes() | 143 | void Tag::clearAttributes() | ||
144 | { | 144 | { | ||
145 | d_ptr->mAttributeStorage.clearAttributes(); | 145 | d_ptr->mAttributeStorage.clearAttributes(); | ||
146 | } | 146 | } | ||
147 | 147 | | |||
148 | Attribute *Tag::attribute(const QByteArray &type) const | 148 | const Attribute *Tag::attribute(const QByteArray &type) const | ||
149 | { | 149 | { | ||
150 | return d_ptr->mAttributeStorage.attribute(type); | 150 | return d_ptr->mAttributeStorage.attribute(type); | ||
151 | } | 151 | } | ||
152 | 152 | | |||
153 | Attribute *Tag::attribute(const QByteArray &type) | ||||
154 | { | ||||
155 | markAttributeModified(type); | ||||
156 | return d_ptr->mAttributeStorage.attribute(type); | ||||
157 | } | ||||
158 | | ||||
153 | void Tag::setId(Tag::Id identifier) | 159 | void Tag::setId(Tag::Id identifier) | ||
154 | { | 160 | { | ||
155 | d_ptr->id = identifier; | 161 | d_ptr->id = identifier; | ||
156 | } | 162 | } | ||
157 | 163 | | |||
158 | Tag::Id Tag::id() const | 164 | Tag::Id Tag::id() const | ||
159 | { | 165 | { | ||
160 | return d_ptr->id; | 166 | return d_ptr->id; | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
239 | { | 245 | { | ||
240 | Tag tag; | 246 | Tag tag; | ||
241 | tag.d_ptr->type = GENERIC; | 247 | tag.d_ptr->type = GENERIC; | ||
242 | tag.d_ptr->gid = QUuid::createUuid().toByteArray().mid(1, 36); | 248 | tag.d_ptr->gid = QUuid::createUuid().toByteArray().mid(1, 36); | ||
243 | tag.setName(name); | 249 | tag.setName(name); | ||
244 | return tag; | 250 | return tag; | ||
245 | } | 251 | } | ||
246 | 252 | | |||
247 | bool Tag::checkAttribute(Attribute *attr, const QByteArray &type) const | 253 | bool Tag::checkAttribute(const Attribute *attr, const QByteArray &type) const | ||
248 | { | 254 | { | ||
249 | if (attr) { | 255 | if (attr) { | ||
250 | return true; | 256 | return true; | ||
251 | } | 257 | } | ||
252 | qCWarning(AKONADICORE_LOG) << "Found attribute of unknown type" << type | 258 | qCWarning(AKONADICORE_LOG) << "Found attribute of unknown type" << type | ||
253 | << ". Did you forget to call AttributeFactory::registerAttribute()?"; | 259 | << ". Did you forget to call AttributeFactory::registerAttribute()?"; | ||
254 | return false; | 260 | return false; | ||
255 | } | 261 | } | ||
256 | 262 | | |||
257 | void Tag::markAttributeModified(const QByteArray &type) | 263 | void Tag::markAttributeModified(const QByteArray &type) | ||
258 | { | 264 | { | ||
259 | d_ptr->mAttributeStorage.markAttributeModified(type); | 265 | d_ptr->mAttributeStorage.markAttributeModified(type); | ||
260 | } | 266 | } |