File indexing completed on 2024-06-23 05:18:37

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "sendlaterinfo.h"
0008 
0009 using namespace MessageComposer;
0010 
0011 bool SendLaterInfo::isValid() const
0012 {
0013     return (mId != -1) && mDateTime.isValid();
0014 }
0015 
0016 bool SendLaterInfo::isRecurrence() const
0017 {
0018     return mRecurrence;
0019 }
0020 
0021 void SendLaterInfo::setRecurrence(bool b)
0022 {
0023     mRecurrence = b;
0024 }
0025 
0026 void SendLaterInfo::setRecurrenceUnit(SendLaterInfo::RecurrenceUnit unit)
0027 {
0028     mRecurrenceUnit = unit;
0029 }
0030 
0031 SendLaterInfo::RecurrenceUnit SendLaterInfo::recurrenceUnit() const
0032 {
0033     return mRecurrenceUnit;
0034 }
0035 
0036 void SendLaterInfo::setRecurrenceEachValue(int value)
0037 {
0038     mRecurrenceEachValue = value;
0039 }
0040 
0041 int SendLaterInfo::recurrenceEachValue() const
0042 {
0043     return mRecurrenceEachValue;
0044 }
0045 
0046 void SendLaterInfo::setItemId(Akonadi::Item::Id id)
0047 {
0048     mId = id;
0049 }
0050 
0051 Akonadi::Item::Id SendLaterInfo::itemId() const
0052 {
0053     return mId;
0054 }
0055 
0056 void SendLaterInfo::setDateTime(const QDateTime &time)
0057 {
0058     mDateTime = time;
0059 }
0060 
0061 QDateTime SendLaterInfo::dateTime() const
0062 {
0063     return mDateTime;
0064 }
0065 
0066 void SendLaterInfo::setLastDateTimeSend(const QDateTime &dateTime)
0067 {
0068     mLastDateTimeSend = dateTime;
0069 }
0070 
0071 QDateTime SendLaterInfo::lastDateTimeSend() const
0072 {
0073     return mLastDateTimeSend;
0074 }
0075 
0076 void SendLaterInfo::setSubject(const QString &subject)
0077 {
0078     mSubject = subject;
0079 }
0080 
0081 QString SendLaterInfo::subject() const
0082 {
0083     return mSubject;
0084 }
0085 
0086 void SendLaterInfo::setTo(const QString &to)
0087 {
0088     mTo = to;
0089 }
0090 
0091 QString SendLaterInfo::to() const
0092 {
0093     return mTo;
0094 }
0095 
0096 bool SendLaterInfo::operator==(const SendLaterInfo &other) const
0097 {
0098     return (itemId() == other.itemId()) && (recurrenceUnit() == other.recurrenceUnit()) && (recurrenceEachValue() == other.recurrenceEachValue())
0099         && (isRecurrence() == other.isRecurrence()) && (dateTime() == other.dateTime()) && (lastDateTimeSend() == other.lastDateTimeSend())
0100         && (subject() == other.subject()) && (to() == other.to());
0101 }
0102 
0103 QDebug operator<<(QDebug d, const SendLaterInfo &info)
0104 {
0105     d << "mTo: " << info.to();
0106     d << "mSubject: " << info.subject();
0107     d << "mDateTime: " << info.dateTime().toString();
0108     d << "mLastDateTimeSend: " << info.lastDateTimeSend().toString();
0109     d << "mId: " << info.itemId();
0110     d << "mRecurrenceEachValue: " << info.recurrenceEachValue();
0111     d << "mRecurrenceUnit: " << info.recurrenceUnit();
0112     d << "mRecurrence: " << info.isRecurrence();
0113     return d;
0114 }