[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdesupport/attica/lib
From: Frederik Gladhorn <gladhorn () kde ! org>
Date: 2010-07-31 19:56:26
Message-ID: 20100731195626.BEA73AC783 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1157659 by gladhorn:
move comment type enum into comment class, also conversion between string and comment \
can be static
M +22 -0 comment.cpp
M +8 -0 comment.h
M +4 -25 provider.cpp
M +5 -13 provider.h
--- trunk/kdesupport/attica/lib/comment.cpp #1157658:1157659
@@ -28,6 +28,28 @@
using namespace Attica;
+QString Comment::commentTypeToString(const Comment::Type type)
+{
+ switch(type) {
+ case ContentComment:
+ return QString("1");
+ break;
+ case ForumComment:
+ return QString("4");
+ break;
+ case KnowledgeBaseComment:
+ return QString("7");
+ break;
+ case EventComment:
+ return QString("8");
+ break;
+ }
+
+ Q_ASSERT(false);
+ return QString();
+}
+
+
class Comment::Private : public QSharedData {
public:
QString m_id;
--- trunk/kdesupport/attica/lib/comment.h #1157658:1157659
@@ -41,6 +41,14 @@
typedef QList<Comment> List;
class Parser;
+ enum Type {
+ ContentComment,
+ ForumComment,
+ KnowledgeBaseComment,
+ EventComment
+ };
+ static QString commentTypeToString(const Comment::Type type);
+
Comment();
Comment(const Comment& other);
Comment& operator=(const Comment& other);
--- trunk/kdesupport/attica/lib/provider.cpp #1157658:1157659
@@ -690,10 +690,10 @@
return job;
}
-ListJob<Comment>* Provider::requestComments(const Provider::CommentType commentType, \
const QString& id, const QString& id2, int page, int pageSize) +ListJob<Comment>* \
Provider::requestComments(const Comment::Type commentType, const QString& id, const \
QString& id2, int page, int pageSize) {
QString commentTypeString;
- commentTypeString = commentTypeToString(commentType);
+ commentTypeString = Comment::commentTypeToString(commentType);
if (!commentTypeString.isEmpty()) {
return 0;
}
@@ -707,10 +707,10 @@
return job;
}
-PostJob* Provider::addNewComment(const Provider::CommentType commentType, const \
QString& id, const QString& id2, const QString& parentId, const QString &subject, \
const QString& message) +PostJob* Provider::addNewComment(const Comment::Type \
commentType, const QString& id, const QString& id2, const QString& parentId, const \
QString &subject, const QString& message) {
QString commentTypeString;
- commentTypeString = commentTypeToString(commentType);
+ commentTypeString = Comment::commentTypeToString(commentType);
if (!commentTypeString.isEmpty()) {
return 0;
}
@@ -740,27 +740,6 @@
return new PostJob(d->m_internals, createRequest(url), postParameters);
}
-QString Provider::commentTypeToString(const Provider::CommentType type) const
-{
- switch(type) {
- case ContentComment:
- return QString("1");
- break;
- case ForumComment:
- return QString("4");
- break;
- case KnowledgeBaseComment:
- return QString("7");
- break;
- case EventComment:
- return QString("8");
- break;
- }
-
- Q_ASSERT(false);
- return QString();
-}
-
PostJob* Provider::setPrivateData(const QString& app, const QString& key, const \
QString& value) {
QUrl url = createUrl("privatedata/setattribute/" + app + "/" + key);
--- trunk/kdesupport/attica/lib/provider.h #1157658:1157659
@@ -35,6 +35,7 @@
#include "itemjob.h"
#include "listjob.h"
#include "message.h"
+#include "comment.h"
class QDate;
class QUrl;
@@ -48,7 +49,6 @@
class AccountBalance;
class Activity;
class PrivateData;
-class Comment;
class Content;
class DownloadItem;
class Distribution;
@@ -61,6 +61,7 @@
class PostJob;
class Provider;
+
/**
* The Provider class represents one Open Collaboration Service provider.
* Use the ProviderManager to instanciate a Provider.
@@ -396,22 +397,15 @@
ListJob<Event>* requestEvent(const QString& country, const QString& search, \
const QDate& startAt, SortMode mode, int page, int pageSize);
// Comment part of OCS
- enum CommentType {
- ContentComment,
- ForumComment,
- KnowledgeBaseComment,
- EventComment
- };
-
/** Request a list of comments for a content / forum / knowledgebase / event.
- * @param commentType type of the comment @see CommentType (content / forum / \
knowledgebase / event) + * @param comment::Type type of the comment @see \
Comment::Type (content / forum / knowledgebase / event)
* @param id id of the content entry where you want to get the comments is from
* @param id2 id of the content entry where you want to get the comments is from
* @param page request nth page in the list of results
* @param pageSize requested size of pages when calculating the list of results
* @return list job for the comments results
*/
- ListJob<Comment>* requestComments(const CommentType commentType, const QString& \
id, const QString& id2, int page, int pageSize); + ListJob<Comment>* \
requestComments(const Comment::Type commentType, const QString& id, const QString& \
id2, int page, int pageSize);
/** Add a new comment.
* @param commentType type of the comment @see CommentType (content / forum / \
knowledgebase / event) @@ -422,7 +416,7 @@
* @param message text of the comment
* @return post job for adding the new comment
*/
- PostJob* addNewComment(const CommentType commentType, const QString& id, const \
QString& id2, const QString& parentId, const QString &subject, const QString& \
message); + PostJob* addNewComment(const Comment::Type commentType, const QString& \
id, const QString& id2, const QString& parentId, const QString &subject, const \
QString& message);
/** Vote a comment item
* @param id the comment id which this voting is for
@@ -459,8 +453,6 @@
const QString& activity, const QString& content, const QString& fan,
const QString& knowledgebase, const QString& event, const QString& \
comment);
- QString commentTypeToString(const Provider::CommentType type) const;
-
friend class ProviderManager;
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic