File indexing completed on 2024-09-29 06:29:19

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2009 Marco Martin <notmart@gmail.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #include "knowledgebaseentry.h"
0010 
0011 using namespace Attica;
0012 
0013 class Q_DECL_HIDDEN KnowledgeBaseEntry::Private : public QSharedData
0014 {
0015 public:
0016     QString m_id;
0017     int m_contentId;
0018     QString m_user;
0019     QString m_status;
0020     QDateTime m_changed;
0021     QString m_name;
0022     QString m_description;
0023     QString m_answer;
0024     int m_comments;
0025     QUrl m_detailPage;
0026 
0027     QMap<QString, QString> m_extendedAttributes;
0028 
0029     Private()
0030         : m_contentId(0)
0031         , m_comments(0)
0032     {
0033     }
0034 };
0035 
0036 KnowledgeBaseEntry::KnowledgeBaseEntry()
0037     : d(new Private)
0038 {
0039 }
0040 
0041 KnowledgeBaseEntry::KnowledgeBaseEntry(const KnowledgeBaseEntry &other)
0042     : d(other.d)
0043 {
0044 }
0045 
0046 KnowledgeBaseEntry &KnowledgeBaseEntry::operator=(const Attica::KnowledgeBaseEntry &other)
0047 {
0048     d = other.d;
0049     return *this;
0050 }
0051 
0052 KnowledgeBaseEntry::~KnowledgeBaseEntry()
0053 {
0054 }
0055 
0056 void KnowledgeBaseEntry::setId(QString id)
0057 {
0058     d->m_id = std::move(id); // TODO KF6 Make QString const & and remove the std::move
0059 }
0060 
0061 QString KnowledgeBaseEntry::id() const
0062 {
0063     return d->m_id;
0064 }
0065 
0066 void KnowledgeBaseEntry::setContentId(int id)
0067 {
0068     d->m_contentId = id;
0069 }
0070 
0071 int KnowledgeBaseEntry::contentId() const
0072 {
0073     return d->m_contentId;
0074 }
0075 
0076 void KnowledgeBaseEntry::setUser(const QString &user)
0077 {
0078     d->m_user = user;
0079 }
0080 
0081 QString KnowledgeBaseEntry::user() const
0082 {
0083     return d->m_user;
0084 }
0085 
0086 void KnowledgeBaseEntry::setStatus(const QString &status)
0087 {
0088     d->m_status = status;
0089 }
0090 
0091 QString KnowledgeBaseEntry::status() const
0092 {
0093     return d->m_status;
0094 }
0095 
0096 void KnowledgeBaseEntry::setChanged(const QDateTime &changed)
0097 {
0098     d->m_changed = changed;
0099 }
0100 
0101 QDateTime KnowledgeBaseEntry::changed() const
0102 {
0103     return d->m_changed;
0104 }
0105 
0106 void KnowledgeBaseEntry::setName(const QString &name)
0107 {
0108     d->m_name = name;
0109 }
0110 
0111 QString KnowledgeBaseEntry::name() const
0112 {
0113     return d->m_name;
0114 }
0115 
0116 void KnowledgeBaseEntry::setDescription(const QString &description)
0117 {
0118     d->m_description = description;
0119 }
0120 
0121 QString KnowledgeBaseEntry::description() const
0122 {
0123     return d->m_description;
0124 }
0125 
0126 void KnowledgeBaseEntry::setAnswer(const QString &answer)
0127 {
0128     d->m_answer = answer;
0129 }
0130 
0131 QString KnowledgeBaseEntry::answer() const
0132 {
0133     return d->m_answer;
0134 }
0135 
0136 void KnowledgeBaseEntry::setComments(int comments)
0137 {
0138     d->m_comments = comments;
0139 }
0140 
0141 int KnowledgeBaseEntry::comments() const
0142 {
0143     return d->m_comments;
0144 }
0145 
0146 void KnowledgeBaseEntry::setDetailPage(const QUrl &detailPage)
0147 {
0148     d->m_detailPage = detailPage;
0149 }
0150 
0151 QUrl KnowledgeBaseEntry::detailPage() const
0152 {
0153     return d->m_detailPage;
0154 }
0155 
0156 void KnowledgeBaseEntry::addExtendedAttribute(const QString &key, const QString &value)
0157 {
0158     d->m_extendedAttributes.insert(key, value);
0159 }
0160 
0161 QString KnowledgeBaseEntry::extendedAttribute(const QString &key) const
0162 {
0163     return d->m_extendedAttributes.value(key);
0164 }
0165 
0166 QMap<QString, QString> KnowledgeBaseEntry::extendedAttributes() const
0167 {
0168     return d->m_extendedAttributes;
0169 }
0170 
0171 bool KnowledgeBaseEntry::isValid() const
0172 {
0173     return !(d->m_id.isEmpty());
0174 }