KLdap

ldapsearchclientreadconfigserverjob.cpp
1/*
2 * SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "ldapsearchclientreadconfigserverjob.h"
8#include "ldapclient.h"
9#include "ldapclient_core_debug.h"
10#include "ldapclientsearchconfigreadconfigjob.h"
11using namespace KLDAPCore;
12LdapSearchClientReadConfigServerJob::LdapSearchClientReadConfigServerJob(QObject *parent)
13 : QObject(parent)
14{
15}
16
17LdapSearchClientReadConfigServerJob::~LdapSearchClientReadConfigServerJob() = default;
18
19void LdapSearchClientReadConfigServerJob::start()
20{
21 if (!canStart()) {
22 qCWarning(LDAPCLIENT_CORE_LOG) << " Impossible to start LdapSearchClientReadConfigServerJob";
24 return;
25 }
26 auto job = new LdapClientSearchConfigReadConfigJob(this);
27 connect(job, &LdapClientSearchConfigReadConfigJob::configLoaded, this, &LdapSearchClientReadConfigServerJob::slotConfigLoaded);
28 job->setActive(mActive);
29 job->setConfig(mConfig);
30 job->setServerIndex(mCurrentIndex);
31 job->start();
32}
33
34bool LdapSearchClientReadConfigServerJob::canStart() const
35{
36 return mCurrentIndex != -1 && mConfig.isValid();
37}
38
39void LdapSearchClientReadConfigServerJob::slotConfigLoaded(const KLDAPCore::LdapServer &server)
40{
41 mLdapClient->setServer(server);
43}
44
45LdapClient *LdapSearchClientReadConfigServerJob::ldapClient() const
46{
47 return mLdapClient;
48}
49
50void LdapSearchClientReadConfigServerJob::setLdapClient(LdapClient *ldapClient)
51{
52 mLdapClient = ldapClient;
53}
54
55int LdapSearchClientReadConfigServerJob::currentIndex() const
56{
57 return mCurrentIndex;
58}
59
60void LdapSearchClientReadConfigServerJob::setCurrentIndex(int currentIndex)
61{
62 mCurrentIndex = currentIndex;
63}
64
65bool LdapSearchClientReadConfigServerJob::active() const
66{
67 return mActive;
68}
69
70void LdapSearchClientReadConfigServerJob::setActive(bool active)
71{
72 mActive = active;
73}
74
75KConfigGroup LdapSearchClientReadConfigServerJob::config() const
76{
77 return mConfig;
78}
79
80void LdapSearchClientReadConfigServerJob::setConfig(const KConfigGroup &config)
81{
82 mConfig = config;
83}
84
85#include "moc_ldapsearchclientreadconfigserverjob.cpp"
bool isValid() const
An object that represents a configured LDAP server.
Definition ldapclient.h:29
void setServer(const KLDAPCore::LdapServer &server)
Sets the LDAP server information that shall be used by this client.
A class that contains LDAP server connection settings.
Definition ldapserver.h:27
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:07 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.