1 | /* |
---|---|
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2010 Intel Corporation |
5 | SPDX-FileContributor: Mateu Batle Sastre <mbatle@collabora.co.uk> |
6 | |
7 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
8 | */ |
9 | |
10 | #ifndef ATTICA_COMMENT_H |
11 | #define ATTICA_COMMENT_H |
12 | |
13 | #include "attica_export.h" |
14 | |
15 | #include <QDateTime> |
16 | #include <QSharedDataPointer> |
17 | |
18 | #include <QUrl> |
19 | |
20 | namespace Attica |
21 | { |
22 | |
23 | /** |
24 | * @class Comment comment.h <Attica/Comment> |
25 | * |
26 | * Represents a comment. |
27 | */ |
28 | class ATTICA_EXPORT Comment |
29 | { |
30 | public: |
31 | typedef QList<Comment> List; |
32 | class Parser; |
33 | |
34 | enum Type { |
35 | ContentComment, |
36 | ForumComment, |
37 | KnowledgeBaseComment, |
38 | EventComment, |
39 | }; |
40 | static QString commentTypeToString(const Comment::Type type); |
41 | |
42 | Comment(); |
43 | Comment(const Comment &other); |
44 | Comment &operator=(const Comment &other); |
45 | ~Comment(); |
46 | |
47 | void setId(const QString &id); |
48 | QString id() const; |
49 | |
50 | void setSubject(const QString &subject); |
51 | QString subject() const; |
52 | |
53 | void setText(const QString &text); |
54 | QString text() const; |
55 | |
56 | void setChildCount(const int childCount); |
57 | int childCount() const; |
58 | |
59 | void setUser(const QString &user); |
60 | QString user() const; |
61 | |
62 | void setDate(const QDateTime &date); |
63 | QDateTime date() const; |
64 | |
65 | /** |
66 | This is for internal usage, @see Provider::setCommentScore to set scores in comments. |
67 | @param score average comment score in scale from 0 to 100 |
68 | */ |
69 | void setScore(const int score); |
70 | /** |
71 | Returns score of this comment. |
72 | @param score average comment score in scale from 0 to 100 |
73 | */ |
74 | int score() const; |
75 | |
76 | void setChildren(QList<Comment> comments); |
77 | QList<Comment> children() const; |
78 | |
79 | bool isValid() const; |
80 | |
81 | private: |
82 | class Private; |
83 | QSharedDataPointer<Private> d; |
84 | }; |
85 | |
86 | } |
87 | |
88 | #endif |
89 |