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

0001 /*
0002     This file is part of oxaccess.
0003 
0004     SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include "folder.h"
0012 #include "object.h"
0013 
0014 class KJob;
0015 
0016 class QDomDocument;
0017 class QDomElement;
0018 
0019 namespace OXA
0020 {
0021 namespace ObjectUtils
0022 {
0023 Object parseObject(const QDomElement &propElement, Folder::Module module);
0024 void addObjectElements(QDomDocument &document, QDomElement &propElement, const Object &object, void *preloadedData = nullptr);
0025 
0026 /**
0027  * Returns the dav path that is used for the given @p module.
0028  */
0029 QString davPath(Folder::Module module);
0030 
0031 /**
0032  * On some actions (e.g. creating or modifying items) we have to preload
0033  * data asynchronously. The following methods allow to do that in a generic way.
0034  */
0035 
0036 /**
0037  * Checks whether the @p object needs preloading of data.
0038  */
0039 bool needsPreloading(const Object &object);
0040 
0041 /**
0042  * Creates a preloading job for the @p object.
0043  */
0044 KJob *preloadJob(const Object &object);
0045 
0046 /**
0047  * Converts the data loaded by the preloading @p job into pointer
0048  * that will be passed to addObjectElements later on.
0049  */
0050 void *preloadData(const Object &object, KJob *job);
0051 }
0052 }