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 LdapClientSearchConfigWriteConfigJob : public QObject
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit LdapClientSearchConfigWriteConfigJob(QObject *parent = nullptr);
0023     ~LdapClientSearchConfigWriteConfigJob() 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     [[nodiscard]] KLDAPCore::LdapServer server() const;
0038     void setServer(const KLDAPCore::LdapServer &server);
0039 
0040 Q_SIGNALS:
0041     void configSaved();
0042 
0043 private:
0044     KLDAPWIDGETS_NO_EXPORT void writeLdapClientConfigFinished();
0045     KLDAPWIDGETS_NO_EXPORT void writeConfig();
0046     int mServerIndex = -1;
0047     KConfigGroup mConfig;
0048     bool mActive = false;
0049     KLDAPCore::LdapServer mServer;
0050 };
0051 
0052 }