File indexing completed on 2024-11-24 04:44:29
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 "object.h" 0014 0015 namespace OXA 0016 { 0017 /** 0018 * @short A job that requests the delta for objects changes from the OX server. 0019 * 0020 * @author Tobias Koenig <tokoe@kde.org> 0021 */ 0022 class ObjectsRequestDeltaJob : public KJob 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 /** 0028 * Creates a new objects request delta job. 0029 * 0030 * @param folder The folder the objects shall be request from. 0031 * @param lastSync The timestamp of the last sync. Only added, modified and deleted objects 0032 * after this date will be requested. 0 will request all available objects. 0033 * @param parent The parent object. 0034 */ 0035 ObjectsRequestDeltaJob(const Folder &folder, qulonglong lastSync, QObject *parent = nullptr); 0036 0037 /** 0038 * Starts the job. 0039 */ 0040 void start() override; 0041 0042 /** 0043 * Returns the list of all added and modified objects. 0044 */ 0045 [[nodiscard]] Object::List modifiedObjects() const; 0046 0047 /** 0048 * Returns the list of all deleted objects. 0049 */ 0050 [[nodiscard]] Object::List deletedObjects() const; 0051 0052 private: 0053 void fetchModifiedJobFinished(KJob *); 0054 void fetchDeletedJobFinished(KJob *); 0055 Folder mFolder; 0056 qulonglong mLastSync; 0057 Object::List mModifiedObjects; 0058 Object::List mDeletedObjects; 0059 int mJobFinishedCount = 0; 0060 }; 0061 }