1 | /* |
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2008 Cornelius Schumacher <schumacher@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #include "message.h" |
10 | |
11 | using namespace Attica; |
12 | |
13 | class Q_DECL_HIDDEN Message::Private : public QSharedData |
14 | { |
15 | public: |
16 | QString m_id; |
17 | QString m_from; |
18 | QString m_to; |
19 | QDateTime m_sent; |
20 | Status m_status; |
21 | QString m_subject; |
22 | QString m_body; |
23 | |
24 | Private() |
25 | : m_status(Unread) |
26 | { |
27 | } |
28 | }; |
29 | |
30 | Message::Message() |
31 | : d(new Private) |
32 | { |
33 | } |
34 | |
35 | Message::Message(const Message &other) |
36 | : d(other.d) |
37 | { |
38 | } |
39 | |
40 | Message &Message::operator=(const Attica::Message &other) |
41 | { |
42 | d = other.d; |
43 | return *this; |
44 | } |
45 | |
46 | Message::~Message() |
47 | { |
48 | } |
49 | |
50 | void Message::setId(const QString &u) |
51 | { |
52 | d->m_id = u; |
53 | } |
54 | |
55 | QString Message::id() const |
56 | { |
57 | return d->m_id; |
58 | } |
59 | |
60 | void Message::setFrom(const QString &n) |
61 | { |
62 | d->m_from = n; |
63 | } |
64 | |
65 | QString Message::from() const |
66 | { |
67 | return d->m_from; |
68 | } |
69 | |
70 | void Message::setTo(const QString &n) |
71 | { |
72 | d->m_to = n; |
73 | } |
74 | |
75 | QString Message::to() const |
76 | { |
77 | return d->m_to; |
78 | } |
79 | |
80 | void Message::setSent(const QDateTime &date) |
81 | { |
82 | d->m_sent = date; |
83 | } |
84 | |
85 | QDateTime Message::sent() const |
86 | { |
87 | return d->m_sent; |
88 | } |
89 | |
90 | void Message::setStatus(Message::Status s) |
91 | { |
92 | d->m_status = s; |
93 | } |
94 | |
95 | Message::Status Message::status() const |
96 | { |
97 | return d->m_status; |
98 | } |
99 | |
100 | void Message::setSubject(const QString &subject) |
101 | { |
102 | d->m_subject = subject; |
103 | } |
104 | |
105 | QString Message::subject() const |
106 | { |
107 | return d->m_subject; |
108 | } |
109 | |
110 | void Message::setBody(const QString &body) |
111 | { |
112 | d->m_body = body; |
113 | } |
114 | |
115 | QString Message::body() const |
116 | { |
117 | return d->m_body; |
118 | } |
119 | |
120 | bool Message::isValid() const |
121 | { |
122 | return !(d->m_id.isEmpty()); |
123 | } |
124 | |