~ubuntu-branches/debian/jessie/attica-kf5/jessie

« back to all changes in this revision

Viewing changes to src/knowledgebaseentry.cpp

  • Committer: Package Import Robot
  • Author(s): Maximiliano Curia
  • Date: 2014-07-15 10:53:09 UTC
  • Revision ID: package-import@ubuntu.com-20140715105309-nnjxenwcs6h4qznf
Tags: upstream-5.0.0
ImportĀ upstreamĀ versionĀ 5.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of KDE.
 
3
 
 
4
    Copyright (C) 2009 Marco Martin <notmart@gmail.com>
 
5
 
 
6
    This library is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU Lesser General Public
 
8
    License as published by the Free Software Foundation; either
 
9
    version 2.1 of the License, or (at your option) version 3, or any
 
10
    later version accepted by the membership of KDE e.V. (or its
 
11
    successor approved by the membership of KDE e.V.), which shall
 
12
    act as a proxy defined in Section 6 of version 3 of the license.
 
13
 
 
14
    This library is distributed in the hope that it will be useful,
 
15
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
    Lesser General Public License for more details.
 
18
 
 
19
    You should have received a copy of the GNU Lesser General Public
 
20
    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
21
 
 
22
*/
 
23
 
 
24
#include "knowledgebaseentry.h"
 
25
 
 
26
#include <QMap>
 
27
 
 
28
using namespace Attica;
 
29
 
 
30
class KnowledgeBaseEntry::Private : public QSharedData
 
31
{
 
32
public:
 
33
    QString m_id;
 
34
    int m_contentId;
 
35
    QString m_user;
 
36
    QString m_status;
 
37
    QDateTime m_changed;
 
38
    QString m_name;
 
39
    QString m_description;
 
40
    QString m_answer;
 
41
    int m_comments;
 
42
    QUrl m_detailPage;
 
43
 
 
44
    QMap<QString, QString> m_extendedAttributes;
 
45
 
 
46
    Private()
 
47
        : m_contentId(0),
 
48
          m_comments(0)
 
49
    {
 
50
    }
 
51
};
 
52
 
 
53
KnowledgeBaseEntry::KnowledgeBaseEntry()
 
54
    : d(new Private)
 
55
{
 
56
}
 
57
 
 
58
KnowledgeBaseEntry::KnowledgeBaseEntry(const KnowledgeBaseEntry &other)
 
59
    : d(other.d)
 
60
{
 
61
}
 
62
 
 
63
KnowledgeBaseEntry &KnowledgeBaseEntry::operator=(const Attica::KnowledgeBaseEntry &other)
 
64
{
 
65
    d = other.d;
 
66
    return *this;
 
67
}
 
68
 
 
69
KnowledgeBaseEntry::~KnowledgeBaseEntry()
 
70
{
 
71
}
 
72
 
 
73
void KnowledgeBaseEntry::setId(QString id)
 
74
{
 
75
    d->m_id = id;
 
76
}
 
77
 
 
78
QString KnowledgeBaseEntry::id() const
 
79
{
 
80
    return d->m_id;
 
81
}
 
82
 
 
83
void KnowledgeBaseEntry::setContentId(int id)
 
84
{
 
85
    d->m_contentId = id;
 
86
}
 
87
 
 
88
int KnowledgeBaseEntry::contentId() const
 
89
{
 
90
    return d->m_contentId;
 
91
}
 
92
 
 
93
void KnowledgeBaseEntry::setUser(const QString &user)
 
94
{
 
95
    d->m_user = user;
 
96
}
 
97
 
 
98
QString KnowledgeBaseEntry::user() const
 
99
{
 
100
    return d->m_user;
 
101
}
 
102
 
 
103
void KnowledgeBaseEntry::setStatus(const QString &status)
 
104
{
 
105
    d->m_status = status;
 
106
}
 
107
 
 
108
QString KnowledgeBaseEntry::status() const
 
109
{
 
110
    return d->m_status;
 
111
}
 
112
 
 
113
void KnowledgeBaseEntry::setChanged(const QDateTime &changed)
 
114
{
 
115
    d->m_changed = changed;
 
116
}
 
117
 
 
118
QDateTime KnowledgeBaseEntry::changed() const
 
119
{
 
120
    return d->m_changed;
 
121
}
 
122
 
 
123
void KnowledgeBaseEntry::setName(const QString &name)
 
124
{
 
125
    d->m_name = name;
 
126
}
 
127
 
 
128
QString KnowledgeBaseEntry::name() const
 
129
{
 
130
    return d->m_name;
 
131
}
 
132
 
 
133
void KnowledgeBaseEntry::setDescription(const QString &description)
 
134
{
 
135
    d->m_description = description;
 
136
}
 
137
 
 
138
QString KnowledgeBaseEntry::description() const
 
139
{
 
140
    return d->m_description;
 
141
}
 
142
 
 
143
void KnowledgeBaseEntry::setAnswer(const QString &answer)
 
144
{
 
145
    d->m_answer = answer;
 
146
}
 
147
 
 
148
QString KnowledgeBaseEntry::answer() const
 
149
{
 
150
    return d->m_answer;
 
151
}
 
152
 
 
153
void KnowledgeBaseEntry::setComments(int comments)
 
154
{
 
155
    d->m_comments = comments;
 
156
}
 
157
 
 
158
int KnowledgeBaseEntry::comments() const
 
159
{
 
160
    return d->m_comments;
 
161
}
 
162
 
 
163
void KnowledgeBaseEntry::setDetailPage(const QUrl &detailPage)
 
164
{
 
165
    d->m_detailPage = detailPage;
 
166
}
 
167
 
 
168
QUrl KnowledgeBaseEntry::detailPage() const
 
169
{
 
170
    return d->m_detailPage;
 
171
}
 
172
 
 
173
void KnowledgeBaseEntry::addExtendedAttribute(const QString &key, const QString &value)
 
174
{
 
175
    d->m_extendedAttributes.insert(key, value);
 
176
}
 
177
 
 
178
QString KnowledgeBaseEntry::extendedAttribute(const QString &key) const
 
179
{
 
180
    return d->m_extendedAttributes.value(key);
 
181
}
 
182
 
 
183
QMap<QString, QString> KnowledgeBaseEntry::extendedAttributes() const
 
184
{
 
185
    return d->m_extendedAttributes;
 
186
}
 
187
 
 
188
bool KnowledgeBaseEntry::isValid() const
 
189
{
 
190
    return !(d->m_id.isEmpty());
 
191
}