summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-07-12 07:54:17 +0200
committerMontel Laurent <[email protected]>2017-07-12 07:54:17 +0200
commit23ed23d88d944ac0544ce915f0d6b609ec816f4a (patch)
tree3e9fe574f20c9dda4373ff7b90fed37c40293e6b
parent7a1508bba4d274061ce5105f34bef16990959483 (diff)
Add initialize code
-rw-r--r--src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.cpp29
-rw-r--r--src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.h5
2 files changed, 30 insertions, 4 deletions
diff --git a/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.cpp b/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.cpp
index c622555..6972115 100644
--- a/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.cpp
+++ b/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.cpp
@@ -26,8 +26,9 @@
using namespace KPIM;
-AddresseeLineEditLdap::AddresseeLineEditLdap(AddresseeLineEditStatic *addressLineStatic)
- : mLdapTimer(nullptr)
+AddresseeLineEditLdap::AddresseeLineEditLdap(AddresseeLineEditStatic *addressLineStatic, QObject *parent)
+ : QObject(parent)
+ , mLdapTimer(nullptr)
, mLdapSearch(nullptr)
, mAddressLineStatic(addressLineStatic)
{
@@ -63,3 +64,27 @@ KLDAP::LdapClientSearch *AddresseeLineEditLdap::ldapSearch() const
{
return mLdapSearch;
}
+
+void AddresseeLineEditLdap::init()
+{
+ if (!mLdapTimer) {
+ mLdapTimer = new QTimer(this);
+ mLdapSearch = new KLDAP::LdapClientSearch(this);
+
+ /* The reasoning behind this filter is:
+ * If it's a person, or a distlist, show it, even if it doesn't have an email address.
+ * If it's not a person, or a distlist, only show it if it has an email attribute.
+ * This allows both resource accounts with an email address which are not a person and
+ * person entries without an email address to show up, while still not showing things
+ * like structural entries in the ldap tree.
+ */
+
+#if 0
+ mLdapSearch->setFilter(QStringLiteral("&(|(objectclass=person)(objectclass=groupOfNames)(mail=*))"
+ "(|(cn=%1*)(mail=%1*)(mail=*@%1*)(givenName=%1*)(sn=%1*))"));
+#endif
+ //Fix bug 323272 "Exchange doesn't like any queries beginning with *."
+ mLdapSearch->setFilter(QStringLiteral("&(|(objectclass=person)(objectclass=groupOfNames)(mail=*))"
+ "(|(cn=%1*)(mail=%1*)(givenName=%1*)(sn=%1*))"));
+ }
+}
diff --git a/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.h b/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.h
index a9c9cfa..4d6c875 100644
--- a/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.h
+++ b/src/libkdepimakonadi/addressline/addresslineedit/addresseelineeditldap.h
@@ -30,10 +30,10 @@ class LdapClientSearch;
namespace KPIM {
class AddresseeLineEditStatic;
-class AddresseeLineEditLdap
+class AddresseeLineEditLdap : public QObject
{
public:
- explicit AddresseeLineEditLdap(AddresseeLineEditStatic *addressLineStatic);
+ explicit AddresseeLineEditLdap(AddresseeLineEditStatic *addressLineStatic, QObject *parent = nullptr);
~AddresseeLineEditLdap();
void updateLDAPWeights();
@@ -42,6 +42,7 @@ public:
KLDAP::LdapClientSearch *ldapSearch() const;
+ void init();
private:
// maps LDAP client indices to completion source indices
// the assumption that they are always the first n indices in s_static->completion