Libkdav2

davprincipalsearchjob.h
1 /*
2  Copyright (c) 2011 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_DAVPRINCIPALSEARCHJOB_H
20 #define KDAV2_DAVPRINCIPALSEARCHJOB_H
21 
22 #include "kpimkdav2_export.h"
23 
24 #include "davjobbase.h"
25 #include "davurl.h"
26 
27 #include <QtCore/QList>
28 #include <QtCore/QPair>
29 #include <QtCore/QString>
30 
31 #include <KCoreAddons/KJob>
32 
33 class QDomDocument;
34 
35 namespace KDAV2
36 {
37 
46 class KPIMKDAV2_EXPORT DavPrincipalSearchJob : public DavJobBase
47 {
48  Q_OBJECT
49 
50 public:
56  enum FilterType {
57  DisplayName,
58  EmailAddress
59  };
60 
64  struct Result {
65  QString propertyNamespace;
66  QString property;
67  QString value;
68  };
69 
78  explicit DavPrincipalSearchJob(const DavUrl &url, FilterType type, const QString &filter, QObject *parent = nullptr);
79 
86  void fetchProperty(const QString &name, const QString &ns = QString());
87 
91  void start() Q_DECL_OVERRIDE;
92 
96  DavUrl davUrl() const;
97 
101  QList<Result> results() const;
102 
103 private Q_SLOTS:
104  void principalCollectionSetSearchFinished(KJob *job);
105  void principalPropertySearchFinished(KJob *job);
106 
107 private:
108  void buildReportQuery(QDomDocument &query);
109 
110 private:
111  DavUrl mUrl;
112  FilterType mType;
113  QString mFilter;
114  int mPrincipalPropertySearchSubJobCount;
115  bool mPrincipalPropertySearchSubJobSuccessful;
116  QList< QPair<QString, QString> > mFetchProperties;
117  QList<Result> mResults;
118 };
119 
120 }
121 
122 #endif
base class for the jobs used by the resource.
Definition: davjobbase.h:37
A helper class to combine url and protocol of a DAV url.
Definition: davurl.h:35
FilterType
Types of search that are supported by this job.
A job that search a DAV principal on a server.
Simple struct to hold the search job results.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Oct 27 2020 23:23:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.