KDAV

davprincipalsearchjob.h
1/*
2 SPDX-FileCopyrightText: 2011 Grégory Oestreicher <greg@kamago.net>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KDAV_DAVPRINCIPALSEARCHJOB_H
8#define KDAV_DAVPRINCIPALSEARCHJOB_H
9
10#include "kdav_export.h"
11
12#include "davjobbase.h"
13#include "davurl.h"
14
15#include <QString>
16
17namespace KDAV
18{
19class DavPrincipalSearchJobPrivate;
20
21/**
22 * @class DavPrincipalSearchJob davprincipalsearchjob.h <KDAV/DavPrincipalSearchJob>
23 *
24 * @short A job that search a DAV principal on a server
25 *
26 * This job is used to search a principal on a server
27 * that implement the dav-property-search REPORT (RFC3744).
28 *
29 * The properties to fetch are set with @ref fetchProperty().
30 */
31class KDAV_EXPORT DavPrincipalSearchJob : public DavJobBase
32{
33 Q_OBJECT
34
35public:
36 /**
37 * Types of search that are supported by this job.
38 * DisplayName will match on the DAV displayname property.
39 * EmailAddress will match on the CalDav calendar-user-address-set property.
40 */
42 DisplayName,
43 EmailAddress,
44 };
45
46 /**
47 * Simple struct to hold the search job results
48 */
49 struct Result {
50 QString propertyNamespace;
51 QString property;
52 QString value;
53 };
54
55 /**
56 * Creates a new DAV principal search job
57 *
58 * @param url The URL to use in the REPORT query.
59 * @param type The type that the filter will match.
60 * @param filter The filter that will be used to match the displayname attribute.
61 * @param parent The parent object.
62 */
63 explicit DavPrincipalSearchJob(const DavUrl &url, FilterType type, const QString &filter, QObject *parent = nullptr);
64
65 /**
66 * Add a new property to fetch from the server.
67 *
68 * @param name The name of the property.
69 * @param ns The namespace of this property, defaults to 'DAV:'.
70 */
71 void fetchProperty(const QString &name, const QString &ns = QString());
72
73 /**
74 * Starts the job
75 */
76 void start() override;
77
78 /**
79 * Return the DavUrl used by this job
80 */
81 Q_REQUIRED_RESULT DavUrl davUrl() const;
82
83 /**
84 * Get the job results.
85 */
86 Q_REQUIRED_RESULT QList<Result> results() const;
87
88private:
89 Q_DECLARE_PRIVATE(DavPrincipalSearchJob)
90};
91}
92
93Q_DECLARE_TYPEINFO(KDAV::DavPrincipalSearchJob::Result, Q_RELOCATABLE_TYPE);
94#endif
base class for the jobs used by the resource.
Definition davjobbase.h:27
A job that search a DAV principal on a server.
FilterType
Types of search that are supported by this job.
A helper class to combine URL and protocol of a DAV URL.
Definition davurl.h:27
Q_SCRIPTABLE Q_NOREPLY void start()
The KDAV namespace.
Simple struct to hold the search job results.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.