taskattribute.cpp 985 Bytes
Newer Older
1
/*
2
  SPDX-FileCopyrightText: 2014-2020 Laurent Montel <montel@kde.org>
3

4
  SPDX-License-Identifier: GPL-2.0-only
5 6 7 8 9
*/

#include "taskattribute.h"

#include <QByteArray>
10
#include <QDataStream>
11 12

TaskAttribute::TaskAttribute()
Laurent Montel's avatar
Laurent Montel committed
13
    : Akonadi::Attribute()
14
{
Laurent Montel's avatar
Laurent Montel committed
15 16 17
}

TaskAttribute::TaskAttribute(Akonadi::Item::Id id)
Laurent Montel's avatar
Laurent Montel committed
18 19
    : Akonadi::Attribute()
    , mId(id)
Laurent Montel's avatar
Laurent Montel committed
20
{
21 22 23 24 25 26
}

TaskAttribute::~TaskAttribute()
{
}

Laurent Montel's avatar
Laurent Montel committed
27
TaskAttribute *TaskAttribute::clone() const
28
{
Laurent Montel's avatar
Laurent Montel committed
29
    return new TaskAttribute(taskId());
30 31
}

Laurent Montel's avatar
Laurent Montel committed
32
void TaskAttribute::deserialize(const QByteArray &data)
33
{
Laurent Montel's avatar
Laurent Montel committed
34
    QDataStream s(data);
35 36 37
    s >> mId;
}

38
void TaskAttribute::setTaskId(Akonadi::Item::Id id)
39 40 41 42
{
    mId = id;
}

43
Akonadi::Item::Id TaskAttribute::taskId() const
44 45 46 47 48 49 50
{
    return mId;
}

QByteArray TaskAttribute::serialized() const
{
    QByteArray result;
Laurent Montel's avatar
Laurent Montel committed
51
    QDataStream s(&result, QIODevice::WriteOnly);
52 53 54 55 56 57
    s << mId;
    return result;
}

QByteArray TaskAttribute::type() const
{
Laurent Montel's avatar
Laurent Montel committed
58
    static const QByteArray sType("TaskAttribute");
Laurent Montel's avatar
Laurent Montel committed
59
    return sType;
60
}