File indexing completed on 2024-11-17 04:45:07

0001 /*
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0003     SPDX-FileContributor: Kevin Ottens <kevin@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "resourcetask.h"
0011 
0012 #include <KIMAP/ImapSet>
0013 
0014 class MoveItemsTask : public ResourceTask
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     explicit MoveItemsTask(const ResourceStateInterface::Ptr &resource, QObject *parent = nullptr);
0020     ~MoveItemsTask() override;
0021 
0022 private Q_SLOTS:
0023     void onSelectDone(KJob *job);
0024     void onCopyDone(KJob *job);
0025     void onStoreFlagsDone(KJob *job);
0026     void onMoveDone(KJob *job);
0027 
0028     void onPreSearchSelectDone(KJob *job);
0029     void onSearchDone(KJob *job);
0030 
0031 protected:
0032     void doStart(KIMAP::Session *session) override;
0033 
0034 private:
0035     void startMove(KIMAP::Session *session);
0036     void recordNewUid();
0037     QList<qint64> imapSetToList(const KIMAP::ImapSet &set);
0038 
0039     KIMAP::ImapSet m_oldSet;
0040     QList<qint64> m_newUids;
0041     QMap<Akonadi::Item::Id /* original ID */, QByteArray> m_messageIds;
0042 };