File indexing completed on 2024-05-26 05:17:00
0001 /* 0002 Copyright (c) 2010 Grégory Oestreicher <greg@kamago.net> 0003 Based on DavItemsListJob which is copyright (c) 2010 Tobias Koenig <tokoe@kde.org> 0004 0005 This program is free software; you can redistribute it and/or modify 0006 it under the terms of the GNU General Public License as published by 0007 the Free Software Foundation; either version 2 of the License, or 0008 (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KDAV2_DAVITEMSFETCHJOB_H 0021 #define KDAV2_DAVITEMSFETCHJOB_H 0022 0023 #include "kpimkdav2_export.h" 0024 0025 #include "davitem.h" 0026 #include "davjobbase.h" 0027 #include "davurl.h" 0028 0029 #include <QtCore/QMap> 0030 #include <QtCore/QStringList> 0031 0032 namespace KDAV2 0033 { 0034 0035 /** 0036 * @short A job that fetches a list of items from a DAV server using a multiget query. 0037 */ 0038 class KPIMKDAV2_EXPORT DavItemsFetchJob : public DavJobBase 0039 { 0040 Q_OBJECT 0041 0042 public: 0043 /** 0044 * Creates a new items fetch job. 0045 * 0046 * @param collectionUrl The DAV collection on which to run the query 0047 * @param urls The list of urls to fetch 0048 * @param parent The parent object 0049 */ 0050 DavItemsFetchJob(const DavUrl &collectionUrl, const QStringList &urls, QObject *parent = nullptr); 0051 0052 /** 0053 * Starts the job. 0054 */ 0055 void start() Q_DECL_OVERRIDE; 0056 0057 /** 0058 * Returns the list of fetched items 0059 */ 0060 DavItem::List items() const; 0061 0062 /** 0063 * Return the item found at @p url 0064 */ 0065 DavItem item(const QString &url) const; 0066 0067 private Q_SLOTS: 0068 void davJobFinished(KJob *); 0069 0070 private: 0071 DavUrl mCollectionUrl; 0072 QStringList mUrls; 0073 QMap<QString, DavItem> mItems; 0074 }; 0075 0076 } 0077 0078 #endif