File indexing completed on 2024-12-15 04:51:46
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #include "notealarmattribute.h" 0007 0008 #include <QByteArray> 0009 #include <QDataStream> 0010 #include <QIODevice> 0011 0012 using namespace NoteShared; 0013 NoteAlarmAttribute::NoteAlarmAttribute() 0014 : Akonadi::Attribute() 0015 { 0016 } 0017 0018 NoteAlarmAttribute::~NoteAlarmAttribute() = default; 0019 0020 NoteAlarmAttribute *NoteAlarmAttribute::clone() const 0021 { 0022 auto attr = new NoteAlarmAttribute(); 0023 attr->setDateTime(dateTime()); 0024 return attr; 0025 } 0026 0027 void NoteAlarmAttribute::deserialize(const QByteArray &data) 0028 { 0029 QDataStream s(data); 0030 s >> mDateTime; 0031 } 0032 0033 QByteArray NoteAlarmAttribute::serialized() const 0034 { 0035 QByteArray result; 0036 QDataStream s(&result, QIODevice::WriteOnly); 0037 s << mDateTime; 0038 return result; 0039 } 0040 0041 QByteArray NoteAlarmAttribute::type() const 0042 { 0043 static const QByteArray sType("NoteAlarmAttribute"); 0044 return sType; 0045 } 0046 0047 void NoteAlarmAttribute::setDateTime(const QDateTime &dateTime) 0048 { 0049 mDateTime = dateTime; 0050 } 0051 0052 QDateTime NoteAlarmAttribute::dateTime() const 0053 { 0054 return mDateTime; 0055 } 0056 0057 bool NoteAlarmAttribute::operator==(const NoteAlarmAttribute &other) const 0058 { 0059 return mDateTime == other.dateTime(); 0060 }