1 | /* |
---|---|
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2009 Marco Martin <notmart@gmail.com> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #include "knowledgebaseentry.h" |
10 | |
11 | using namespace Attica; |
12 | |
13 | class Q_DECL_HIDDEN KnowledgeBaseEntry::Private : public QSharedData |
14 | { |
15 | public: |
16 | QString m_id; |
17 | int m_contentId; |
18 | QString m_user; |
19 | QString m_status; |
20 | QDateTime m_changed; |
21 | QString m_name; |
22 | QString m_description; |
23 | QString m_answer; |
24 | int m_comments; |
25 | QUrl m_detailPage; |
26 | |
27 | QMap<QString, QString> m_extendedAttributes; |
28 | |
29 | Private() |
30 | : m_contentId(0) |
31 | , m_comments(0) |
32 | { |
33 | } |
34 | }; |
35 | |
36 | KnowledgeBaseEntry::KnowledgeBaseEntry() |
37 | : d(new Private) |
38 | { |
39 | } |
40 | |
41 | KnowledgeBaseEntry::KnowledgeBaseEntry(const KnowledgeBaseEntry &other) |
42 | : d(other.d) |
43 | { |
44 | } |
45 | |
46 | KnowledgeBaseEntry &KnowledgeBaseEntry::operator=(const Attica::KnowledgeBaseEntry &other) |
47 | { |
48 | d = other.d; |
49 | return *this; |
50 | } |
51 | |
52 | KnowledgeBaseEntry::~KnowledgeBaseEntry() |
53 | { |
54 | } |
55 | |
56 | void KnowledgeBaseEntry::setId(QString id) |
57 | { |
58 | d->m_id = std::move(id); // TODO KF6 Make QString const & and remove the std::move |
59 | } |
60 | |
61 | QString KnowledgeBaseEntry::id() const |
62 | { |
63 | return d->m_id; |
64 | } |
65 | |
66 | void KnowledgeBaseEntry::setContentId(int id) |
67 | { |
68 | d->m_contentId = id; |
69 | } |
70 | |
71 | int KnowledgeBaseEntry::contentId() const |
72 | { |
73 | return d->m_contentId; |
74 | } |
75 | |
76 | void KnowledgeBaseEntry::setUser(const QString &user) |
77 | { |
78 | d->m_user = user; |
79 | } |
80 | |
81 | QString KnowledgeBaseEntry::user() const |
82 | { |
83 | return d->m_user; |
84 | } |
85 | |
86 | void KnowledgeBaseEntry::setStatus(const QString &status) |
87 | { |
88 | d->m_status = status; |
89 | } |
90 | |
91 | QString KnowledgeBaseEntry::status() const |
92 | { |
93 | return d->m_status; |
94 | } |
95 | |
96 | void KnowledgeBaseEntry::setChanged(const QDateTime &changed) |
97 | { |
98 | d->m_changed = changed; |
99 | } |
100 | |
101 | QDateTime KnowledgeBaseEntry::changed() const |
102 | { |
103 | return d->m_changed; |
104 | } |
105 | |
106 | void KnowledgeBaseEntry::setName(const QString &name) |
107 | { |
108 | d->m_name = name; |
109 | } |
110 | |
111 | QString KnowledgeBaseEntry::name() const |
112 | { |
113 | return d->m_name; |
114 | } |
115 | |
116 | void KnowledgeBaseEntry::setDescription(const QString &description) |
117 | { |
118 | d->m_description = description; |
119 | } |
120 | |
121 | QString KnowledgeBaseEntry::description() const |
122 | { |
123 | return d->m_description; |
124 | } |
125 | |
126 | void KnowledgeBaseEntry::setAnswer(const QString &answer) |
127 | { |
128 | d->m_answer = answer; |
129 | } |
130 | |
131 | QString KnowledgeBaseEntry::answer() const |
132 | { |
133 | return d->m_answer; |
134 | } |
135 | |
136 | void KnowledgeBaseEntry::setComments(int comments) |
137 | { |
138 | d->m_comments = comments; |
139 | } |
140 | |
141 | int KnowledgeBaseEntry::comments() const |
142 | { |
143 | return d->m_comments; |
144 | } |
145 | |
146 | void KnowledgeBaseEntry::setDetailPage(const QUrl &detailPage) |
147 | { |
148 | d->m_detailPage = detailPage; |
149 | } |
150 | |
151 | QUrl KnowledgeBaseEntry::detailPage() const |
152 | { |
153 | return d->m_detailPage; |
154 | } |
155 | |
156 | void KnowledgeBaseEntry::addExtendedAttribute(const QString &key, const QString &value) |
157 | { |
158 | d->m_extendedAttributes.insert(key, value); |
159 | } |
160 | |
161 | QString KnowledgeBaseEntry::extendedAttribute(const QString &key) const |
162 | { |
163 | return d->m_extendedAttributes.value(key); |
164 | } |
165 | |
166 | QMap<QString, QString> KnowledgeBaseEntry::extendedAttributes() const |
167 | { |
168 | return d->m_extendedAttributes; |
169 | } |
170 | |
171 | bool KnowledgeBaseEntry::isValid() const |
172 | { |
173 | return !(d->m_id.isEmpty()); |
174 | } |
175 |