File indexing completed on 2024-05-12 05:22:32

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #include "task.h"
0010 #include "debug.h"
0011 
0012 using namespace KGAPI2;
0013 
0014 class Q_DECL_HIDDEN Task::Private
0015 {
0016 public:
0017     Private() = default;
0018     Private(const Private &other) = default;
0019 
0020     bool deleted = false;
0021 };
0022 
0023 Task::Task()
0024     : Object()
0025     , KCalendarCore::Todo()
0026     , d(new Private)
0027 {
0028 }
0029 
0030 Task::Task(const Task &other)
0031     : Object(other)
0032     , KCalendarCore::Todo(other)
0033     , d(new Private(*(other.d.get())))
0034 {
0035 }
0036 
0037 Task::Task(const KCalendarCore::Todo &other)
0038     : Object()
0039     , KCalendarCore::Todo(other)
0040     , d(new Private)
0041 {
0042 }
0043 
0044 Task::~Task() = default;
0045 
0046 bool Task::operator==(const Task &other) const
0047 {
0048     if (!Object::operator==(other)) {
0049         qCDebug(KGAPIDebug) << "Objects don't match";
0050         return false;
0051     }
0052     if (!Todo::operator==(other)) {
0053         qCDebug(KGAPIDebug) << "Todos don't match";
0054         return false;
0055     }
0056     if (d->deleted != other.d->deleted) {
0057         qCDebug(KGAPIDebug) << "Deleted does not match";
0058         return false;
0059     }
0060 
0061     return true;
0062 }
0063 
0064 void Task::setDeleted(const bool deleted)
0065 {
0066     d->deleted = deleted;
0067 }
0068 
0069 bool Task::deleted() const
0070 {
0071     return d->deleted;
0072 }