/usr/include/KPim/kdav/davprincipalsearchjob.h is in libkpimkdav-dev 17.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /*
Copyright (c) 2011 Grégory Oestreicher <greg@kamago.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KDAV_DAVPRINCIPALSEARCHJOB_H
#define KDAV_DAVPRINCIPALSEARCHJOB_H
#include "kpimkdav_export.h"
#include "davjobbase.h"
#include "davurl.h"
#include <QList>
#include <QPair>
#include <QString>
#include <KJob>
class QDomDocument;
namespace KDAV
{
/**
* @short A job that search a DAV principal on a server
*
* This job is used to search a principal on a server
* that implement the dav-property-search REPORT (RFC3744).
*
* The properties to fetch are set with @ref fetchProperty().
*/
class KPIMKDAV_EXPORT DavPrincipalSearchJob : public DavJobBase
{
Q_OBJECT
public:
/**
* Types of search that are supported by this job.
* DisplayName will match on the DAV displayname property.
* EmailAddress will match on the CalDav calendar-user-address-set property.
*/
enum FilterType {
DisplayName,
EmailAddress
};
/**
* Simple struct to hold the search job results
*/
struct Result {
QString propertyNamespace;
QString property;
QString value;
};
/**
* Creates a new dav principal search job
*
* @param url The URL to use in the REPORT query.
* @param type The type that the filter will match.
* @param filter The filter that will be used to match the displayname attribute.
* @param parent The parent object.
*/
explicit DavPrincipalSearchJob(const DavUrl &url, FilterType type, const QString &filter, QObject *parent = nullptr);
/**
* Add a new property to fetch from the server.
*
* @param name The name of the property.
* @param ns The namespace of this property, defaults to 'DAV:'.
*/
void fetchProperty(const QString &name, const QString &ns = QString());
/**
* Starts the job
*/
void start() override;
/**
* Return the DavUrl used by this job
*/
DavUrl davUrl() const;
/**
* Get the job results.
*/
QList<Result> results() const;
private:
void principalCollectionSetSearchFinished(KJob *job);
void principalPropertySearchFinished(KJob *job);
void buildReportQuery(QDomDocument &query);
private:
DavUrl mUrl;
FilterType mType;
QString mFilter;
int mPrincipalPropertySearchSubJobCount;
bool mPrincipalPropertySearchSubJobSuccessful;
QList< QPair<QString, QString> > mFetchProperties;
QList<Result> mResults;
};
}
#endif
|