File indexing completed on 2024-05-12 05:22:11

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005  */
0006 
0007 #include "commentdeletejob.h"
0008 #include "account.h"
0009 #include "bloggerservice.h"
0010 #include "comment.h"
0011 #include "utils.h"
0012 
0013 #include <QNetworkReply>
0014 #include <QNetworkRequest>
0015 
0016 using namespace KGAPI2;
0017 using namespace KGAPI2::Blogger;
0018 
0019 class Q_DECL_HIDDEN CommentDeleteJob::Private
0020 {
0021 public:
0022     Private(const QString &blogId, const QString &postId, const QString &commentId);
0023 
0024     const QString blogId;
0025     const QString postId;
0026     const QString commentId;
0027 };
0028 
0029 CommentDeleteJob::Private::Private(const QString &blogId_, const QString &postId_, const QString &commentId_)
0030     : blogId(blogId_)
0031     , postId(postId_)
0032     , commentId(commentId_)
0033 {
0034 }
0035 
0036 CommentDeleteJob::CommentDeleteJob(const CommentPtr &comment, const AccountPtr &account, QObject *parent)
0037     : DeleteJob(account, parent)
0038     , d(new Private(comment->blogId(), comment->postId(), comment->id()))
0039 {
0040 }
0041 
0042 CommentDeleteJob::CommentDeleteJob(const QString &blogId, const QString &postId, const QString &commentId, const AccountPtr &account, QObject *parent)
0043     : DeleteJob(account, parent)
0044     , d(new Private(blogId, postId, commentId))
0045 {
0046 }
0047 
0048 CommentDeleteJob::~CommentDeleteJob()
0049 {
0050     delete d;
0051 }
0052 
0053 void CommentDeleteJob::start()
0054 {
0055     QNetworkRequest request(BloggerService::deleteCommentUrl(d->blogId, d->postId, d->commentId));
0056 
0057     enqueueRequest(request);
0058 }
0059 
0060 void CommentDeleteJob::handleReply(const QNetworkReply *reply, const QByteArray &rawData)
0061 {
0062     Q_UNUSED(reply)
0063     Q_UNUSED(rawData)
0064 
0065     emitFinished();
0066 }
0067 
0068 #include "moc_commentdeletejob.cpp"