restoreldapsettingsjob.h 1.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
/*
    SPDX-FileCopyrightText: 2010-2020 Laurent Montel <montel@kde.org>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#ifndef RESTORELDAPSETTINGSJOB_H
#define RESTORELDAPSETTINGSJOB_H

#include <QObject>
#include <KLDAP/LdapServer>
12
#include <KConfigGroup>
13
class KConfig;
Laurent Montel's avatar
Laurent Montel committed
14
15
16
namespace KLDAP {
class LdapClientSearchConfig;
}
17
18
19
20
21
22
23
24
25
26
27
class RestoreLdapSettingsJob : public QObject
{
    Q_OBJECT
public:
    explicit RestoreLdapSettingsJob(QObject *parent = nullptr);
    ~RestoreLdapSettingsJob() override;

    void start();
    KConfig *config() const;
    void setConfig(KConfig *config);
    Q_REQUIRED_RESULT bool canStart() const;
Laurent Montel's avatar
Laurent Montel committed
28
29
30
31
32
33
    Q_REQUIRED_RESULT int entry() const;
    void setEntry(int entry);

    KLDAP::LdapClientSearchConfig *clientSearchConfig() const;
    void setClientSearchConfig(KLDAP::LdapClientSearchConfig *clientSearchConfig);

34
35
36
Q_SIGNALS:
    void restoreDone();
private:
Laurent Montel's avatar
Laurent Montel committed
37
38
    void slotConfigSelectedHostLoaded(const KLDAP::LdapServer &server);
    void slotConfigHostLoaded(const KLDAP::LdapServer &server);
Laurent Montel's avatar
Laurent Montel committed
39
    void restore();
40
    void saveLdapSettings();
Laurent Montel's avatar
Laurent Montel committed
41
    void restoreSettingsDone();
42
43
    void loadNextSelectHostSettings();
    void loadNextHostSettings();
44
45
    QVector<KLDAP::LdapServer> mSelHosts;
    QVector<KLDAP::LdapServer> mHosts;
Laurent Montel's avatar
Laurent Montel committed
46
    int mEntry = -1;
47
48
49
    int mNumSelHosts = -1;
    int mNumHosts = -1;
    int mCurrentIndex = 0;
50
    KConfig *mConfig = nullptr;
51
    KConfigGroup mCurrentGroup;
Laurent Montel's avatar
Laurent Montel committed
52
    KLDAP::LdapClientSearchConfig *mClientSearchConfig = nullptr;
53
54
55
};

#endif // RESTORELDAPSETTINGSJOB_H