KLDAPCore::LdapSearch Class

This class starts a search operation on a LDAP server and returns the search values via a Qt signal. More...

Header: #include <KLDAPCore/LdapSearch>
CMake: find_package(KPim6LdapCore REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::LdapCore)
Inherits: QObject

Public Functions

LdapSearch()
LdapSearch(KLDAPCore::LdapConnection &connection)
virtual ~LdapSearch() override
void abandon()
void continueSearch()
int error() const
QString errorString() const
bool isFinished() const
bool search(const KLDAPCore::LdapUrl &url, int count = 0)
bool search(const KLDAPCore::LdapServer &server, const QStringList &attributes = QStringList(), int count = 0)
bool search(const KLDAPCore::LdapDN &base, LdapUrl::Scope scope = LdapUrl::Sub, const QString &filter = QString(), const QStringList &attributes = QStringList(), int pagesize = 0, int count = 0)
void setClientControls(const KLDAPCore::LdapControls &ctrls)
void setConnection(KLDAPCore::LdapConnection &connection)
void setServerControls(const KLDAPCore::LdapControls &ctrls)

Signals

void data(KLDAPCore::LdapSearch *search, const KLDAPCore::LdapObject &obj)
void result(KLDAPCore::LdapSearch *search)

Detailed Description

Member Function Documentation

LdapSearch::LdapSearch()

Constructs an LdapSearch object.

[explicit] LdapSearch::LdapSearch(KLDAPCore::LdapConnection &connection)

Constructs an LdapConnection object with the given connection. If this form of constructor is used, then always this connection will be used regardless of the LDAP URL or LdapServer object passed to search(). connection the connection used to construct LdapConnection object

[override virtual noexcept] LdapSearch::~LdapSearch()

Destroys the LdapSearch object.

void LdapSearch::abandon()

Tries to abandon the search.

void LdapSearch::continueSearch()

Continues the search (if you set count to non-zero in search(), and isFinished() is false).

[signal] void LdapSearch::data(KLDAPCore::LdapSearch *search, const KLDAPCore::LdapObject &obj)

Emitted for each result object.

int LdapSearch::error() const

Returns the error code of the search operation (0 if no error). Returns the LDAP error code

QString LdapSearch::errorString() const

Returns the error description of the search operation. Returns the error description string

bool LdapSearch::isFinished() const

Returns true if the search is finished, false otherwise. Returns true if the search has finished

[signal] void LdapSearch::result(KLDAPCore::LdapSearch *search)

Emitted when the searching finished.

Starts a search operation on the given LDAP URL. url the LDAP URL to search on count how many entries to list Returns true if the search started successfully, false otherwise

bool LdapSearch::search(const KLDAPCore::LdapServer &server, const QStringList &attributes = QStringList(), int count = 0)

Starts a search operation on the given LDAP server, returning the attributes specified. server the LDAP server to search on attributes the list of attributes to retrieve count how many entries to list. If it's >0, then result() will be emitted when the number of entries is reached, but with isFinished() set to false Returns true if the search started successfully, false otherwise

bool LdapSearch::search(const KLDAPCore::LdapDN &base, LdapUrl::Scope scope = LdapUrl::Sub, const QString &filter = QString(), const QStringList &attributes = QStringList(), int pagesize = 0, int count = 0)

Starts a search operation if the LdapConnection object was already set in the constructor. base the base DN for the search scope the scope of the search filter the LDAP filter string attributes the list of attributes to retrieve pagesize the page size for paged results count how many entries to list Returns true if the search started successfully, false otherwise

void LdapSearch::setClientControls(const KLDAPCore::LdapControls &ctrls)

Sets the client controls which will be sent with each operation. ctrls the LDAP controls to set

void LdapSearch::setConnection(KLDAPCore::LdapConnection &connection)

Sets the connection for this object to use for searches from now onwards, regardless of the LDAP URL or LdapServer object passed to search(). connection the connection to use for searches

void LdapSearch::setServerControls(const KLDAPCore::LdapControls &ctrls)

Sets the server controls which will be sent with each operation. ctrls the LDAP controls to set