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
11using namespace Attica;
12
13class Q_DECL_HIDDEN KnowledgeBaseEntry::Private : public QSharedData
14{
15public:
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
36KnowledgeBaseEntry::KnowledgeBaseEntry()
37 : d(new Private)
38{
39}
40
41KnowledgeBaseEntry::KnowledgeBaseEntry(const KnowledgeBaseEntry &other)
42 : d(other.d)
43{
44}
45
46KnowledgeBaseEntry &KnowledgeBaseEntry::operator=(const Attica::KnowledgeBaseEntry &other)
47{
48 d = other.d;
49 return *this;
50}
51
52KnowledgeBaseEntry::~KnowledgeBaseEntry()
53{
54}
55
56void KnowledgeBaseEntry::setId(QString id)
57{
58 d->m_id = std::move(id); // TODO KF6 Make QString const & and remove the std::move
59}
60
61QString KnowledgeBaseEntry::id() const
62{
63 return d->m_id;
64}
65
66void KnowledgeBaseEntry::setContentId(int id)
67{
68 d->m_contentId = id;
69}
70
71int KnowledgeBaseEntry::contentId() const
72{
73 return d->m_contentId;
74}
75
76void KnowledgeBaseEntry::setUser(const QString &user)
77{
78 d->m_user = user;
79}
80
81QString KnowledgeBaseEntry::user() const
82{
83 return d->m_user;
84}
85
86void KnowledgeBaseEntry::setStatus(const QString &status)
87{
88 d->m_status = status;
89}
90
91QString KnowledgeBaseEntry::status() const
92{
93 return d->m_status;
94}
95
96void KnowledgeBaseEntry::setChanged(const QDateTime &changed)
97{
98 d->m_changed = changed;
99}
100
101QDateTime KnowledgeBaseEntry::changed() const
102{
103 return d->m_changed;
104}
105
106void KnowledgeBaseEntry::setName(const QString &name)
107{
108 d->m_name = name;
109}
110
111QString KnowledgeBaseEntry::name() const
112{
113 return d->m_name;
114}
115
116void KnowledgeBaseEntry::setDescription(const QString &description)
117{
118 d->m_description = description;
119}
120
121QString KnowledgeBaseEntry::description() const
122{
123 return d->m_description;
124}
125
126void KnowledgeBaseEntry::setAnswer(const QString &answer)
127{
128 d->m_answer = answer;
129}
130
131QString KnowledgeBaseEntry::answer() const
132{
133 return d->m_answer;
134}
135
136void KnowledgeBaseEntry::setComments(int comments)
137{
138 d->m_comments = comments;
139}
140
141int KnowledgeBaseEntry::comments() const
142{
143 return d->m_comments;
144}
145
146void KnowledgeBaseEntry::setDetailPage(const QUrl &detailPage)
147{
148 d->m_detailPage = detailPage;
149}
150
151QUrl KnowledgeBaseEntry::detailPage() const
152{
153 return d->m_detailPage;
154}
155
156void KnowledgeBaseEntry::addExtendedAttribute(const QString &key, const QString &value)
157{
158 d->m_extendedAttributes.insert(key, value);
159}
160
161QString KnowledgeBaseEntry::extendedAttribute(const QString &key) const
162{
163 return d->m_extendedAttributes.value(key);
164}
165
166QMap<QString, QString> KnowledgeBaseEntry::extendedAttributes() const
167{
168 return d->m_extendedAttributes;
169}
170
171bool KnowledgeBaseEntry::isValid() const
172{
173 return !(d->m_id.isEmpty());
174}
175

source code of attica/src/knowledgebaseentry.cpp