File indexing completed on 2025-02-02 05:08:37

0001 /*
0002     SPDX-FileCopyrightText: 2010-2024 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <KConfigGroup>
0010 #include <KLDAPCore/LdapServer>
0011 #include <QObject>
0012 class KConfig;
0013 class RestoreLdapSettingsJob : public QObject
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit RestoreLdapSettingsJob(QObject *parent = nullptr);
0018     ~RestoreLdapSettingsJob() override;
0019 
0020     void start();
0021     KConfig *config() const;
0022     void setConfig(KConfig *config);
0023     [[nodiscard]] bool canStart() const;
0024     [[nodiscard]] int entry() const;
0025     void setEntry(int entry);
0026 
0027 Q_SIGNALS:
0028     void restoreDone();
0029 
0030 private:
0031     void slotConfigSelectedHostLoaded(const KLDAPCore::LdapServer &server);
0032     void slotConfigHostLoaded(const KLDAPCore::LdapServer &server);
0033     void restore();
0034     void saveLdapSettings();
0035     void restoreSettingsDone();
0036     void loadNextSelectHostSettings();
0037     void loadNextHostSettings();
0038     void saveNextSelectHostSettings();
0039     void saveNextHostSettings();
0040     QList<KLDAPCore::LdapServer> mSelHosts;
0041     QList<KLDAPCore::LdapServer> mHosts;
0042     int mEntry = -1;
0043     int mNumSelHosts = -1;
0044     int mNumHosts = -1;
0045     int mCurrentIndex = 0;
0046     KConfig *mConfig = nullptr;
0047     KConfigGroup mCurrentGroup;
0048 };