Libkdav2

davprincipalhomesetsfetchjob.h
1 /*
2  Copyright (c) 2010 GrĂ©gory Oestreicher <[email protected]>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef KDAV2_DAVPRINCIPALHOMESETSFETCHJOB_H
20 #define KDAV2_DAVPRINCIPALHOMESETSFETCHJOB_H
21 
22 #include "kpimkdav2_export.h"
23 
24 #include "davjobbase.h"
25 #include "davurl.h"
26 
27 #include <KCoreAddons/KJob>
28 
29 #include <QtCore/QStringList>
30 
31 namespace KDAV2
32 {
33 
34 /**
35  * @short A job that fetches home sets for a principal.
36  */
37 class KPIMKDAV2_EXPORT DavPrincipalHomeSetsFetchJob : public DavJobBase
38 {
39  Q_OBJECT
40 
41 public:
42  /**
43  * Creates a new dav principals home sets fetch job.
44  *
45  * @param url The DAV url of the DAV principal.
46  * @param parent The parent object.
47  */
48  explicit DavPrincipalHomeSetsFetchJob(const DavUrl &url, QObject *parent = nullptr);
49 
50  /**
51  * Starts the job.
52  */
53  void start() Q_DECL_OVERRIDE;
54 
55  /**
56  * Returns the found home sets.
57  */
58  QStringList homeSets() const;
59  QUrl url() const;
60 
61 private Q_SLOTS:
62  void davJobFinished(KJob *);
63 
64 private:
65  /**
66  * Start the fetch process.
67  *
68  * There may be two rounds necessary if the first request
69  * does not returns the home sets, but only the current-user-principal
70  * or the principal-URL. The bool flag is here to prevent requesting
71  * those last two on each request, as they are only fetched in
72  * the first round.
73  *
74  * @param fetchHomeSetsOnly If set to true the request will not include
75  * the current-user-principal and principal-URL props.
76  */
77  void fetchHomeSets(bool fetchHomeSetsOnly);
78 
79  DavUrl mUrl;
80  QStringList mHomeSets;
81 };
82 
83 }
84 
85 #endif
A helper class to combine url and protocol of a DAV url.
Definition: davurl.h:35
Q_SCRIPTABLE Q_NOREPLY void start()
base class for the jobs used by the resource.
Definition: davjobbase.h:37
A job that fetches home sets for a principal.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Wed Aug 10 2022 04:09:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.