KLdap

ldapconfigwidget.h
1/*
2 This file is part of libkldap.
3 SPDX-FileCopyrightText: 2004-2006 Szombathelyi György <gyurco@freemail.hu>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#pragma once
9
10#include <QString>
11#include <QWidget>
12
13#include "kldapwidgets_export.h"
14#include "ldapdn.h"
15#include "ldapobject.h"
16#include "ldapserver.h"
17#include "ldapurl.h"
18
19namespace KLDAPWidgets
20{
21/**
22 @brief LDAP Configuration widget
23
24 This class can be used to query the user for LDAP connection parameters.
25 It's KConfigXT compatible, using widget names starting with kcfg_
26*/
27
28class KLDAPWIDGETS_EXPORT LdapConfigWidget : public QWidget
29{
30 Q_OBJECT
31 Q_FLAGS(WinFlags)
32 Q_PROPERTY(WinFlags features READ features WRITE setFeatures)
33 Q_PROPERTY(QString user READ user WRITE setUser)
34 Q_PROPERTY(QString bindDn READ bindDn WRITE setBindDn)
35 Q_PROPERTY(QString realm READ realm WRITE setRealm)
36 Q_PROPERTY(QString password READ password WRITE setPassword)
37 Q_PROPERTY(QString host READ host WRITE setHost)
38 Q_PROPERTY(int port READ port WRITE setPort)
39 Q_PROPERTY(int version READ version WRITE setVersion)
40 Q_PROPERTY(KLDAPCore::LdapDN dn READ dn WRITE setDn)
41 Q_PROPERTY(QString filter READ filter WRITE setFilter)
42 Q_PROPERTY(QString mech READ mech WRITE setMech)
43 Q_PROPERTY(Security security READ security WRITE setSecurity)
44 Q_PROPERTY(Auth auth READ auth WRITE setAuth)
45 Q_PROPERTY(int sizeLimit READ sizeLimit WRITE setSizeLimit)
46 Q_PROPERTY(int timeLimit READ timeLimit WRITE setTimeLimit)
47 Q_PROPERTY(int pageSize READ pageSize WRITE setPageSize)
48
49public:
50 enum WinFlag {
51 W_USER = 0x1,
52 W_BINDDN = 0x2,
53 W_REALM = 0x4,
54 W_PASS = 0x8,
55 W_HOST = 0x10,
56 W_PORT = 0x20,
57 W_VER = 0x40,
58 W_DN = 0x80,
59 W_FILTER = 0x100,
60 W_SECBOX = 0x200,
61 W_AUTHBOX = 0x400,
62 W_TIMELIMIT = 0x800,
63 W_SIZELIMIT = 0x1000,
64 W_PAGESIZE = 0x2000,
65 W_ALL = 0x2fff
66 };
67 Q_DECLARE_FLAGS(WinFlags, WinFlag)
68
69 enum Security { None, SSL, TLS };
70 Q_ENUM(Security)
71
72 enum Auth { Anonymous, Simple, SASL };
73 Q_ENUM(Auth)
74
75 /** Constructs an empty configuration widget.
76 * You need to call setFlags() after this.
77 * @param parent the QWidget parent
78 * @param fl the window flags to set
79 */
80 explicit LdapConfigWidget(QWidget *parent = nullptr, Qt::WindowFlags fl = {});
81 /** Constructs a configuration widget */
82 explicit LdapConfigWidget(WinFlags flags, QWidget *parent = nullptr, Qt::WindowFlags fl = {});
83 /** Destructs a configuration widget */
85
86 /** Sets the user name. Kconfig widget name: kcfg_ldapuser
87 * @param user the user name to set
88 */
89 void setUser(const QString &user);
90 /** Gets the user name. Kconfig widget name: kcfg_ldapuser */
91 [[nodiscard]] QString user() const;
92
93 /** Sets the password. Kconfig widget name: kcfg_ldappassword
94 * @param password the password to set
95 */
96 void setPassword(const QString &password);
97 /** Gets the password. Kconfig widget name: kcfg_ldappassword */
98 [[nodiscard]] QString password() const;
99
100 /**
101 * Sets the bind dn.
102 * Kconfig widget name: kcfg_ldapbinddn
103 * @param binddn the LDAP Bind DN to set
104 */
105 void setBindDn(const QString &binddn);
106 /** Gets the bind dn. Kconfig widget name: kcfg_ldapbinddn*/
107 [[nodiscard]] QString bindDn() const;
108
109 /** Sets the SASL realm. Kconfig widget name: kcfg_ldaprealm
110 * @param realm the SASL realm to set
111 */
112 void setRealm(const QString &realm);
113 /** Gets the SASL realm. Kconfig widget name: kcfg_ldaprealm */
114 [[nodiscard]] QString realm() const;
115
116 /** Sets the host name. Kconfig widget name: kcfg_ldaphost
117 * @param host the LDAP host to set
118 */
119 void setHost(const QString &host);
120 /** Gets the host name. Kconfig widget name: kcfg_ldaphost */
121 [[nodiscard]] QString host() const;
122
123 /** Sets the LDAP port. Kconfig widget name: kcfg_ldapport
124 * @param port the LDAP port to set
125 */
126 void setPort(int port);
127 /** Gets the LDAP port. Kconfig widget name: kcfg_ldapport */
128 [[nodiscard]] int port() const;
129
130 /** Sets the LDAP protocol version. Kconfig widget name: kcfg_ldapver
131 * @param version the LDAP protocol version to set
132 */
133 void setVersion(int version);
134 /** Gets the LDAP protocol version. Kconfig widget name: kcfg_ldapver */
135 [[nodiscard]] int version() const;
136
137 /** Sets the LDAP Base DN. Kconfig widget name: kcfg_ldapdn
138 * @param dn the LDAP Base DN to set
139 */
140 void setDn(const KLDAPCore::LdapDN &dn);
141 /** Gets the LDAP Base DN. Kconfig widget name: kcfg_ldapdn */
142 [[nodiscard]] KLDAPCore::LdapDN dn() const;
143
144 /** Sets the LDAP Filter. Kconfig widget name: kcfg_ldapfilter
145 * @param filter the LDAP Filter to set
146 */
147 void setFilter(const QString &filter);
148 /** Gets the LDAP Filter. Kconfig widget name: kcfg_ldapfilter */
149 [[nodiscard]] QString filter() const;
150
151 /** Sets the SASL Mechanism. Kconfig widget name: kcfg_ldapsaslmech
152 * @param mech the SASL Mechanism to set
153 */
154 void setMech(const QString &mech);
155 /** Gets the SASL Mechanism. Kconfig widget name: kcfg_ldapsaslmech */
156 [[nodiscard]] QString mech() const;
157
158 /**
159 * Sets the security type (None, SSL, TLS).
160 * Kconfig widget names: kcfg_ldapnosec, kcfg_ldaptls, kcfg_ldapssl
161 * @param security the security type to set
162 */
163 void setSecurity(Security security);
164 /**
165 * Returns the security type.
166 * Kconfig widget names: kcfg_ldapnosec, kcfg_ldaptls, kcfg_ldapssl
167 * @param security the security type to set
168 */
169 [[nodiscard]] Security security() const;
170
171 /**
172 * Sets the authentication type (Anonymous, Simple, SASL).
173 * Kconfig widget names: kcfg_ldapanon, kcfg_ldapsimple, kcfg_ldapsasl
174 * @param auth the authentication type to set
175 */
176 void setAuth(Auth auth);
177 /**
178 * Returns the authentication type.
179 * Kconfig widget names: kcfg_ldapanon, kcfg_ldapsimple, kcfg_ldapsasl
180 * @param auth the authentication type to set
181 */
182 [[nodiscard]] Auth auth() const;
183
184 /**
185 * Sets the size limit.
186 * KConfig widget name: kcfg_ldapsizelimit
187 * @param sizelimit the size limit to set
188 */
189 void setSizeLimit(int sizelimit);
190 /**
191 * Returns the size limit.
192 * KConfig widget name: kcfg_ldapsizelimit
193 */
194 [[nodiscard]] int sizeLimit() const;
195
196 /**
197 * Sets the time limit.
198 * KConfig widget name: kcfg_ldaptimelimit
199 * @param timelimit the time limit to set
200 */
201 void setTimeLimit(int timelimit);
202 /**
203 * Returns the time limit.
204 * KConfig widget name: kcfg_ldaptimelimit
205 */
206 [[nodiscard]] int timeLimit() const;
207
208 /**
209 * Sets the page size.
210 * KConfig widget name: kcfg_ldappagesize
211 * @param pagesize the page size to set
212 */
213 void setPageSize(int pagesize);
214 /**
215 * Returns the page size.
216 * KConfig widget name: kcfg_ldappagesize
217 */
218 [[nodiscard]] int pageSize() const;
219
220 [[nodiscard]] WinFlags features() const;
221 void setFeatures(WinFlags features);
222
223 /**
224 * Returns a LDAP Url constructed from the settings given.
225 * Extensions are filled for use in the LDAP KIO worker.
226 */
227 [[nodiscard]] KLDAPCore::LdapUrl url() const;
228 /**
229 * Set up the widget via an LDAP Url.
230 * @param url the LDAP Url to set
231 */
232 void setUrl(const KLDAPCore::LdapUrl &url);
233
234 /**
235 * Returns an LdapServer object constructed from the settings given.
236 */
237 [[nodiscard]] KLDAPCore::LdapServer server() const;
238 /**
239 * Set up the widget via an LdapServer object.
240 * @param server the LdapServer object to set
241 */
242 void setServer(const KLDAPCore::LdapServer &server);
243
244Q_SIGNALS:
245 /**
246 * @since 4.13
247 */
249
250private:
251 class LdapConfigWidgetPrivate;
252 std::unique_ptr<LdapConfigWidgetPrivate> const d;
253};
254
255Q_DECLARE_OPERATORS_FOR_FLAGS(KLDAPWidgets::LdapConfigWidget::WinFlags)
256}
A class that contains LDAP server connection settings.
Definition ldapserver.h:27
A special url class for LDAP.
Definition ldapurl.h:30
LDAP Configuration widget.
void hostNameChanged(const QString &)
~LdapConfigWidget() override
Destructs a configuration widget.
Q_SCRIPTABLE bool setFilter(const QString &filter)
typedef WindowFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:34 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.