Changeset View
Changeset View
Standalone View
Standalone View
src/core/collection.h
Show First 20 Lines • Show All 543 Lines • ▼ Show 20 Line(s) | 78 | public: | |||
---|---|---|---|---|---|
544 | QSet<QByteArray> keepLocalChanges() const; | 544 | QSet<QByteArray> keepLocalChanges() const; | ||
545 | 545 | | |||
546 | private: | 546 | private: | ||
547 | friend class CollectionCreateJob; | 547 | friend class CollectionCreateJob; | ||
548 | friend class CollectionFetchJob; | 548 | friend class CollectionFetchJob; | ||
549 | friend class CollectionModifyJob; | 549 | friend class CollectionModifyJob; | ||
550 | friend class ProtocolHelper; | 550 | friend class ProtocolHelper; | ||
551 | 551 | | |||
552 | void markAttributesChanged(); | 552 | void markAttributeModified(const QByteArray &type); | ||
553 | 553 | | |||
554 | //@cond PRIVATE | 554 | //@cond PRIVATE | ||
555 | QSharedDataPointer<CollectionPrivate> d_ptr; | 555 | QSharedDataPointer<CollectionPrivate> d_ptr; | ||
556 | friend class CollectionPrivate; | 556 | friend class CollectionPrivate; | ||
557 | //@endcond | 557 | //@endcond | ||
558 | }; | 558 | }; | ||
559 | 559 | | |||
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 T dummy; | 567 | const QByteArray type = T().type(); | ||
568 | if (hasAttribute(dummy.type())) { | 568 | if (hasAttribute(type)) { | ||
569 | T *attr = dynamic_cast<T *>(attribute(dummy.type())); | 569 | T *attr = dynamic_cast<T *>(attribute(type)); | ||
570 | if (attr) { | 570 | if (attr) { | ||
571 | markAttributesChanged(); | 571 | markAttributeModified(type); | ||
572 | return attr; | 572 | return attr; | ||
573 | } | 573 | } | ||
574 | //Reuse 5250 | 574 | //Reuse 5250 | ||
575 | qWarning() << "Found attribute of unknown type" << dummy.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(); | ||
580 | addAttribute(attr); | 580 | addAttribute(attr); | ||
581 | return attr; | 581 | return attr; | ||
582 | } | 582 | } | ||
583 | 583 | | |||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |