File indexing completed on 2025-01-05 04:47:07

0001 /*
0002     This file is part of Akonadi
0003 
0004     SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 #pragma once
0009 
0010 #include "akonadiwidgets_export.h"
0011 #include <Akonadi/Collection>
0012 #include <QObject>
0013 namespace Akonadi
0014 {
0015 class AKONADIWIDGETS_EXPORT ClearCacheFoldersJob : public QObject
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit ClearCacheFoldersJob(const Akonadi::Collection &folder, QObject *parent = nullptr);
0020     explicit ClearCacheFoldersJob(const Akonadi::Collection::List &folders, QObject *parent = nullptr);
0021     ~ClearCacheFoldersJob() override;
0022 
0023     void start();
0024 
0025     [[nodiscard]] bool canStart() const;
0026 
0027     [[nodiscard]] QWidget *parentWidget() const;
0028     void setParentWidget(QWidget *newParentWidget);
0029 
0030     [[nodiscard]] bool canceled() const;
0031     void setCanceled(bool newCanceled);
0032 
0033 Q_SIGNALS:
0034     void clearCacheDone();
0035     void clearNextFolder();
0036     void finished(bool success);
0037 
0038 private:
0039     void slotClearNextFolder();
0040     Akonadi::Collection::List mCollections;
0041     QWidget *mParentWidget = nullptr;
0042     int mNumberJob = 0;
0043     bool mCanceled = false;
0044 };
0045 }