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