File indexing completed on 2025-02-16 03:38:48
0001 /* 0002 This file is part of KDE. 0003 0004 SPDX-FileCopyrightText: 2010 Intel Corporation 0005 SPDX-FileContributor: Mateu Batle Sastre <mbatle@collabora.co.uk> 0006 0007 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0008 */ 0009 0010 #ifndef ATTICA_COMMENT_H 0011 #define ATTICA_COMMENT_H 0012 0013 #include "attica_export.h" 0014 0015 #include <QDateTime> 0016 #include <QSharedDataPointer> 0017 0018 #include <QUrl> 0019 0020 namespace Attica 0021 { 0022 0023 /** 0024 * @class Comment comment.h <Attica/Comment> 0025 * 0026 * Represents a comment. 0027 */ 0028 class ATTICA_EXPORT Comment 0029 { 0030 public: 0031 typedef QList<Comment> List; 0032 class Parser; 0033 0034 enum Type { 0035 ContentComment, 0036 ForumComment, 0037 KnowledgeBaseComment, 0038 EventComment, 0039 }; 0040 static QString commentTypeToString(const Comment::Type type); 0041 0042 Comment(); 0043 Comment(const Comment &other); 0044 Comment &operator=(const Comment &other); 0045 ~Comment(); 0046 0047 void setId(const QString &id); 0048 QString id() const; 0049 0050 void setSubject(const QString &subject); 0051 QString subject() const; 0052 0053 void setText(const QString &text); 0054 QString text() const; 0055 0056 void setChildCount(const int childCount); 0057 int childCount() const; 0058 0059 void setUser(const QString &user); 0060 QString user() const; 0061 0062 void setDate(const QDateTime &date); 0063 QDateTime date() const; 0064 0065 /** 0066 This is for internal usage, @see Provider::setCommentScore to set scores in comments. 0067 @param score average comment score in scale from 0 to 100 0068 */ 0069 void setScore(const int score); 0070 /** 0071 Returns score of this comment. 0072 @param score average comment score in scale from 0 to 100 0073 */ 0074 int score() const; 0075 0076 void setChildren(QList<Comment> comments); 0077 QList<Comment> children() const; 0078 0079 bool isValid() const; 0080 0081 private: 0082 class Private; 0083 QSharedDataPointer<Private> d; 0084 }; 0085 0086 } 0087 0088 #endif