File indexing completed on 2024-11-24 04:44:28

0001 /*
0002     This file is part of oxaccess.
0003 
0004     SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <KJob>
0012 
0013 #include "folder.h"
0014 
0015 namespace OXA
0016 {
0017 /**
0018  * @short A job that requests the delta for folders changes from the OX server.
0019  *
0020  * @author Tobias Koenig <tokoe@kde.org>
0021  */
0022 class FoldersRequestDeltaJob : public KJob
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     /**
0028      * Creates a new folders request delta job.
0029      *
0030      * @param lastSync The timestamp of the last sync. Only added, modified and deleted folders
0031      *                 after this date will be requested. 0 will request all available folders.
0032      * @param parent The parent object.
0033      */
0034     explicit FoldersRequestDeltaJob(qulonglong lastSync, QObject *parent = nullptr);
0035 
0036     /**
0037      * Starts the job.
0038      */
0039     void start() override;
0040 
0041     /**
0042      * Returns the list of all added and modified folders.
0043      */
0044     [[nodiscard]] Folder::List modifiedFolders() const;
0045 
0046     /**
0047      * Returns the list of all deleted folders.
0048      */
0049     [[nodiscard]] Folder::List deletedFolders() const;
0050 
0051 private:
0052     void fetchModifiedJobFinished(KJob *);
0053     void fetchDeletedJobFinished(KJob *);
0054     const qulonglong mLastSync;
0055     Folder::List mModifiedFolders;
0056     Folder::List mDeletedFolders;
0057     int mJobFinishedCount = 0;
0058 };
0059 }