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

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 #pragma once
0009 
0010 #include "deletejob.h"
0011 #include "kgapicalendar_export.h"
0012 
0013 #include <QScopedPointer>
0014 
0015 namespace KGAPI2
0016 {
0017 
0018 /**
0019  * @brief A job to delete one or more calendars from user's Google Calendar
0020  *        account.
0021  *
0022  * Note that all events in these calendars will be removed too. All operations
0023  * are irreversible.
0024  *
0025  * @author Daniel Vrátil <dvratil@redhat.com>
0026  * @since 2.0
0027  */
0028 class KGAPICALENDAR_EXPORT CalendarDeleteJob : public KGAPI2::DeleteJob
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     /**
0034      * @brief Constructs a new job that will delete given @p calendar from user's
0035      *        Google Calendar account
0036      *
0037      * @param calendar Calendar to delete
0038      * @param account Account to authenticate the request
0039      * @param parent
0040      */
0041     explicit CalendarDeleteJob(const CalendarPtr &calendar, const AccountPtr &account, QObject *parent);
0042 
0043     /**
0044      * @brief Constructs a new job that will delete given @p calendars from user's
0045      *        Google Calendar account
0046      *
0047      * @param calendars Calendars to delete
0048      * @param account Account to authenticate the request
0049      * @param parent
0050      */
0051     explicit CalendarDeleteJob(const CalendarsList &calendars, const AccountPtr &account, QObject *parent);
0052 
0053     /**
0054      * @brief Constructs a new job that will delete calendar with given
0055      *        @p calendarId from user's Google Calendar account
0056      *
0057      * @param calendarId ID of calendar to delete
0058      * @param account Account to authenticate the request
0059      * @param parent
0060      */
0061     explicit CalendarDeleteJob(const QString &calendarId, const AccountPtr &account, QObject *parent);
0062 
0063     /**
0064      * @brief Constructs a new job that will delete calendars with given
0065      *        @p calendarsIds from user's Google Calendar account
0066      *
0067      * @param calendarsIds IDs of calendar to delete
0068      * @param account Account to authenticate the request
0069      * @param parent
0070      */
0071     explicit CalendarDeleteJob(const QStringList &calendarsIds, const AccountPtr &account, QObject *parent);
0072 
0073     /**
0074      * @brief Destructor
0075      */
0076     ~CalendarDeleteJob() override;
0077 
0078 protected:
0079     /**
0080      * @brief KGAPI2::Job::start implementation
0081      */
0082     void start() override;
0083 
0084     /**
0085      * @brief KGAPI2::Job::handleReply implementation
0086      *
0087      * @param reply
0088      * @param rawData
0089      */
0090     void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override;
0091 
0092 private:
0093     class Private;
0094     QScopedPointer<Private> const d;
0095     friend class Private;
0096 };
0097 
0098 } // namespace KGAPI2