File indexing completed on 2024-11-24 04:44:29

0001 /*
0002     This file is part of oxaccess.
0003 
0004     SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include "folder.h"
0012 
0013 #include <KCalendarCore/Incidence>
0014 #include <KContacts/Addressee>
0015 #include <KContacts/ContactGroup>
0016 
0017 #include <QList>
0018 #include <QString>
0019 
0020 namespace OXA
0021 {
0022 class Object
0023 {
0024 public:
0025     /**
0026      * Describes a list of objects.
0027      */
0028     using List = QList<Object>;
0029 
0030     /**
0031      * Describes the status of the object.
0032      */
0033     enum ObjectStatus {
0034         Created, ///< The object has been created or modified.
0035         Deleted ///< The object has been deleted.
0036     };
0037 
0038     Object();
0039 
0040     void setObjectStatus(ObjectStatus status);
0041     [[nodiscard]] ObjectStatus objectStatus() const;
0042 
0043     void setObjectId(qlonglong id);
0044     [[nodiscard]] qlonglong objectId() const;
0045 
0046     void setFolderId(qlonglong id);
0047     [[nodiscard]] qlonglong folderId() const;
0048 
0049     void setLastModified(const QString &timeStamp);
0050     [[nodiscard]] QString lastModified() const;
0051 
0052     void setModule(Folder::Module module);
0053     [[nodiscard]] Folder::Module module() const;
0054 
0055     void setContact(const KContacts::Addressee &contact);
0056     [[nodiscard]] KContacts::Addressee contact() const;
0057 
0058     void setContactGroup(const KContacts::ContactGroup &group);
0059     [[nodiscard]] KContacts::ContactGroup contactGroup() const;
0060 
0061     void setEvent(const KCalendarCore::Incidence::Ptr &event);
0062     [[nodiscard]] KCalendarCore::Incidence::Ptr event() const;
0063 
0064     void setTask(const KCalendarCore::Incidence::Ptr &task);
0065     [[nodiscard]] KCalendarCore::Incidence::Ptr task() const;
0066 
0067 private:
0068     ObjectStatus mObjectStatus = Created;
0069     qlonglong mObjectId = -1;
0070     qlonglong mFolderId = -1;
0071     QString mLastModified;
0072     Folder::Module mModule;
0073     KContacts::Addressee mContact;
0074     KContacts::ContactGroup mContactGroup;
0075     KCalendarCore::Incidence::Ptr mEvent;
0076     KCalendarCore::Incidence::Ptr mTask;
0077 };
0078 }
0079 
0080 Q_DECLARE_TYPEINFO(OXA::Object, Q_RELOCATABLE_TYPE);