File indexing completed on 2024-11-10 04:40:27
0001 /* 0002 SPDX-FileCopyrightText: 2011 Christian Mollekopf <chrigi_1@fastmail.fm> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "akonadicore_export.h" 0010 #include "attribute.h" 0011 #include "collection.h" 0012 0013 namespace Akonadi 0014 { 0015 class EntityDeletedAttributePrivate; 0016 0017 /** 0018 * @short An Attribute that marks that an entity was marked as deleted 0019 * 0020 * This class represents the attribute of all hidden items. The hidden 0021 * items shouldn't be displayed in UI applications (unless in some kind 0022 * of "debug" mode). 0023 * 0024 * Example: 0025 * 0026 * @code 0027 * 0028 * @endcode 0029 * 0030 * @author Christian Mollekopf <chrigi_1@fastmail.fm> 0031 * @see Akonadi::Attribute 0032 * @since 4.8 0033 */ 0034 class AKONADICORE_EXPORT EntityDeletedAttribute : public Attribute 0035 { 0036 public: 0037 /** 0038 * Creates a new entity deleted attribute. 0039 */ 0040 explicit EntityDeletedAttribute(); 0041 0042 /** 0043 * Destroys the entity deleted attribute. 0044 */ 0045 ~EntityDeletedAttribute() override; 0046 /** 0047 * Sets the collection used to restore items which have been moved to trash using a TrashJob 0048 * If the Resource is set on the collection, the resource root will be used as fallback during the restore operation. 0049 */ 0050 void setRestoreCollection(const Collection &col); 0051 0052 /** 0053 * Returns the original collection of an item that has been moved to trash using a TrashJob 0054 */ 0055 [[nodiscard]] Collection restoreCollection() const; 0056 0057 /** 0058 * Returns the resource of the restoreCollection 0059 */ 0060 [[nodiscard]] QString restoreResource() const; 0061 0062 /** 0063 * Reimplemented from Attribute 0064 */ 0065 [[nodiscard]] QByteArray type() const override; 0066 0067 /** 0068 * Reimplemented from Attribute 0069 */ 0070 EntityDeletedAttribute *clone() const override; 0071 0072 /** 0073 * Reimplemented from Attribute 0074 */ 0075 [[nodiscard]] QByteArray serialized() const override; 0076 0077 /** 0078 * Reimplemented from Attribute 0079 */ 0080 void deserialize(const QByteArray &data) override; 0081 0082 private: 0083 /// @cond PRIVATE 0084 const std::unique_ptr<EntityDeletedAttributePrivate> d; 0085 /// @endcond 0086 }; 0087 0088 } // namespace Akonadi