File indexing completed on 2025-01-05 04:58:19
0001 /* 0002 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QMap> 0010 #include <QObject> 0011 class QTimer; 0012 0013 namespace KLDAPWidgets 0014 { 0015 class LdapClientSearch; 0016 } 0017 0018 namespace PimCommon 0019 { 0020 class AddresseeLineEditManager; 0021 class AddresseeLineEdit; 0022 class AddresseeLineEditLdap : public QObject 0023 { 0024 public: 0025 explicit AddresseeLineEditLdap(AddresseeLineEditManager *addressLineStatic, QObject *parent = nullptr); 0026 ~AddresseeLineEditLdap() override; 0027 0028 void init(); 0029 0030 void updateLDAPWeights(); 0031 0032 QMap<int, int> ldapClientToCompletionSourceMap() const; 0033 bool isLdapClientToCompletionSourceMapContains(int value) const; 0034 int ldapClientToCompletionSourceValue(int value) const; 0035 0036 KLDAPWidgets::LdapClientSearch *ldapSearch() const; 0037 0038 QTimer *ldapTimer() const; 0039 [[nodiscard]] QString ldapText() const; 0040 void setLdapText(const QString &ldapText); 0041 0042 AddresseeLineEdit *addressLineEdit() const; 0043 void setAddressLineEdit(AddresseeLineEdit *addressLineEdit); 0044 0045 void startLoadingLDAPEntries(); 0046 void stopLDAPLookup(); 0047 void restartLdap(const QString &searchString, AddresseeLineEdit *addressLine); 0048 0049 private: 0050 // maps LDAP client indices to completion source indices 0051 // the assumption that they are always the first n indices in s_static->completion 0052 // does not hold when clients are added later on 0053 QMap<int, int> mLdapClientToCompletionSourceMap; 0054 QString mLdapText; 0055 QTimer *mLdapTimer = nullptr; 0056 AddresseeLineEdit *mAddressLineEdit = nullptr; 0057 KLDAPWidgets::LdapClientSearch *mLdapSearch = nullptr; 0058 0059 AddresseeLineEditManager *mAddressLineStatic = nullptr; 0060 }; 0061 }