File indexing completed on 2024-06-02 05:24:06

0001 /*
0002  * SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 #include "kldapwidgets_export.h"
0009 #include <KConfigGroup>
0010 #include <KLDAPCore/LdapServer>
0011 #include <QObject>
0012 namespace QKeychain
0013 {
0014 class Job;
0015 }
0016 namespace KLDAPWidgets
0017 {
0018 class KLDAPWIDGETS_EXPORT LdapClientSearchConfigReadConfigJob : public QObject
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit LdapClientSearchConfigReadConfigJob(QObject *parent = nullptr);
0023     ~LdapClientSearchConfigReadConfigJob() override;
0024 
0025     [[nodiscard]] bool canStart() const;
0026     void start();
0027 
0028     [[nodiscard]] bool active() const;
0029     void setActive(bool newActive);
0030 
0031     [[nodiscard]] int serverIndex() const;
0032     void setServerIndex(int newServerIndex);
0033 
0034     [[nodiscard]] KConfigGroup config() const;
0035     void setConfig(const KConfigGroup &newConfig);
0036 
0037 Q_SIGNALS:
0038     void configLoaded(const KLDAPCore::LdapServer &server);
0039 
0040 private:
0041     KLDAPWIDGETS_NO_EXPORT void readLdapClientConfigFinished();
0042     KLDAPWIDGETS_NO_EXPORT void readConfig();
0043     int mServerIndex = -1;
0044     KConfigGroup mConfig;
0045     bool mActive = false;
0046     KLDAPCore::LdapServer mServer;
0047 };
0048 
0049 }