Changeset View
Changeset View
Standalone View
Standalone View
src/core/collection.h
Show First 20 Lines • Show All 559 Lines • ▼ Show 20 Line(s) | |||||
560 | AKONADICORE_EXPORT uint qHash(const Akonadi::Collection &collection); | 560 | AKONADICORE_EXPORT uint qHash(const Akonadi::Collection &collection); | ||
561 | 561 | | |||
562 | template <typename T> | 562 | template <typename T> | ||
563 | inline T *Akonadi::Collection::attribute(Collection::CreateOption option) | 563 | inline T *Akonadi::Collection::attribute(Collection::CreateOption option) | ||
564 | { | 564 | { | ||
565 | Q_UNUSED(option); | 565 | Q_UNUSED(option); | ||
566 | 566 | | |||
567 | const QByteArray type = T().type(); | 567 | const QByteArray type = T().type(); | ||
568 | markAttributeModified(type); // do this first in case it detaches | ||||
568 | if (hasAttribute(type)) { | 569 | if (hasAttribute(type)) { | ||
569 | T *attr = dynamic_cast<T *>(attribute(type)); | 570 | T *attr = dynamic_cast<T *>(attribute(type)); | ||
570 | if (attr) { | 571 | if (attr) { | ||
571 | markAttributeModified(type); | | |||
572 | return attr; | 572 | return attr; | ||
573 | } | 573 | } | ||
574 | //Reuse 5250 | 574 | //Reuse 5250 | ||
575 | qWarning() << "Found attribute of unknown type" << type | 575 | qWarning() << "Found attribute of unknown type" << type | ||
576 | << ". Did you forget to call AttributeFactory::registerAttribute()?"; | 576 | << ". Did you forget to call AttributeFactory::registerAttribute()?"; | ||
577 | } | 577 | } | ||
578 | 578 | | |||
579 | T *attr = new T(); | 579 | T *attr = new T(); | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |