1 | /* |
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2011 Laszlo Papp <djszapi@archlinux.us> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #include "forum.h" |
10 | |
11 | using namespace Attica; |
12 | |
13 | class Q_DECL_HIDDEN Forum::Private : public QSharedData |
14 | { |
15 | public: |
16 | QString m_id; |
17 | QString m_name; |
18 | QString m_description; |
19 | QDateTime m_date; |
20 | QUrl m_icon; |
21 | int m_childCount; |
22 | int m_topics; |
23 | QList<Forum> m_children; |
24 | |
25 | Private() |
26 | : m_childCount(0) |
27 | , m_topics(0) |
28 | { |
29 | } |
30 | }; |
31 | |
32 | Forum::Forum() |
33 | : d(new Private) |
34 | { |
35 | } |
36 | |
37 | Forum::Forum(const Forum &other) |
38 | : d(other.d) |
39 | { |
40 | } |
41 | |
42 | Forum &Forum::operator=(const Attica::Forum &other) |
43 | { |
44 | d = other.d; |
45 | return *this; |
46 | } |
47 | |
48 | Forum::~Forum() |
49 | { |
50 | } |
51 | |
52 | void Forum::setId(const QString &id) |
53 | { |
54 | d->m_id = id; |
55 | } |
56 | |
57 | QString Forum::id() const |
58 | { |
59 | return d->m_id; |
60 | } |
61 | |
62 | void Forum::setName(const QString &name) |
63 | { |
64 | d->m_name = name; |
65 | } |
66 | |
67 | QString Forum::name() const |
68 | { |
69 | return d->m_name; |
70 | } |
71 | |
72 | void Forum::setDescription(const QString &description) |
73 | { |
74 | d->m_description = description; |
75 | } |
76 | |
77 | QString Forum::description() const |
78 | { |
79 | return d->m_description; |
80 | } |
81 | |
82 | void Forum::setDate(const QDateTime &date) |
83 | { |
84 | d->m_date = date; |
85 | } |
86 | |
87 | QDateTime Forum::date() const |
88 | { |
89 | return d->m_date; |
90 | } |
91 | |
92 | void Forum::setIcon(const QUrl &icon) |
93 | { |
94 | d->m_icon = icon; |
95 | } |
96 | |
97 | QUrl Forum::icon() const |
98 | { |
99 | return d->m_icon; |
100 | } |
101 | |
102 | void Forum::setChildCount(const int childCount) |
103 | { |
104 | d->m_childCount = childCount; |
105 | } |
106 | |
107 | int Forum::childCount() const |
108 | { |
109 | return d->m_childCount; |
110 | } |
111 | |
112 | void Forum::setChildren(QList<Forum> children) |
113 | { |
114 | d->m_children = std::move(children); // TODO KF6 Make QList const & and remove the std::move |
115 | } |
116 | |
117 | QList<Forum> Forum::children() const |
118 | { |
119 | return d->m_children; |
120 | } |
121 | |
122 | void Forum::setTopics(const int topics) |
123 | { |
124 | d->m_topics = topics; |
125 | } |
126 | |
127 | int Forum::topics() const |
128 | { |
129 | return d->m_topics; |
130 | } |
131 | |
132 | bool Forum::isValid() const |
133 | { |
134 | return !(d->m_id.isEmpty()); |
135 | } |
136 | |