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

0001 /*
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>
0003     SPDX-FileCopyrightText: 2010 Andras Mantia <andras@kdab.com>
0004     SPDX-FileCopyrightText: 2012 Dan Vrátil <dvratil@redhat.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <Akonadi/Collection>
0012 #include <Akonadi/Job>
0013 
0014 #include "akonadi-mime_export.h"
0015 
0016 #include <memory>
0017 
0018 namespace Akonadi
0019 {
0020 class RemoveDuplicatesJobPrivate;
0021 
0022 /**
0023  * @short Job that finds and removes duplicate messages in given collection
0024  *
0025  * This jobs compares all messages in given collections by their Message-Id
0026  * headers and hashes of their bodies and removes duplicates.
0027  *
0028  * @since 4.10
0029  */
0030 class AKONADI_MIME_EXPORT RemoveDuplicatesJob : public Akonadi::Job
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     /**
0036      * Creates a new job that will remove duplicates in @p folder.
0037      *
0038      * @param folder The folder where to search for duplicates
0039      * @param parent The parent object
0040      */
0041     explicit RemoveDuplicatesJob(const Akonadi::Collection &folder, QObject *parent = nullptr);
0042 
0043     /**
0044      * Creates a new job that will remove duplicates in all @p folders.
0045      *
0046      * @param folders Folders where to search for duplicates
0047      * @param parent The parent object
0048      */
0049     RemoveDuplicatesJob(const Akonadi::Collection::List &folders, QObject *parent);
0050 
0051     /**
0052      * Destroys the job.
0053      */
0054     ~RemoveDuplicatesJob() override;
0055 
0056 protected:
0057     void doStart() override;
0058     bool doKill() override;
0059 
0060 private:
0061     friend class RemoveDuplicatesJobPrivate;
0062     std::unique_ptr<RemoveDuplicatesJobPrivate> const d;
0063 };
0064 } /* namespace Akonadi */