Commit 9010f2da authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use new kldap api. Fix crash after moving code as async

parent 00a12398
Pipeline #42972 failed with stage
in 10 minutes and 54 seconds
......@@ -33,7 +33,7 @@ set(KDEPIM_LIB_VERSION "5.16.40")
set(QT_REQUIRED_VERSION "5.13.0")
set(KMIME_LIB_VERSION "5.16.40")
set(KMAILTRANSPORT_LIB_VERSION "5.16.40")
set(KLDAP_LIB_VERSION "5.16.43")
set(KLDAP_LIB_VERSION "5.16.44")
set(CALENDARUTILS_LIB_VERSION "5.16.40")
set(CALENDARSUPPORT_LIB_VERSION "5.16.40")
set(LIBKDEPIM_LIB_VERSION "5.16.40")
......
......@@ -17,22 +17,22 @@ ResourceModel::ResourceModel(const QStringList &headers, QObject *parent)
{
this->mHeaders = headers;
mRootItem = ResourceItem::Ptr(new ResourceItem(KLDAP::LdapDN(), headers, KLDAP::LdapClient(0)));
const QStringList attrs = QStringList() << KLDAP::LdapClientSearch::defaultAttributes() << QStringLiteral("uniqueMember");
mLdapSearchCollections = new KLDAP::LdapClientSearch(attrs, this);
mLdapSearch = new KLDAP::LdapClientSearch(headers, this);
mLdapSearchCollections.setFilter(QStringLiteral(
mLdapSearchCollections->setFilter(QStringLiteral(
"&(ou=Resources,*)(objectClass=kolabGroupOfUniqueNames)(objectclass=groupofurls)(!(objectclass=nstombstone))(mail=*)"
"(cn=%1)"));
mLdapSearch.setFilter(QStringLiteral(
mLdapSearch->setFilter(QStringLiteral(
"&(objectClass=kolabSharedFolder)(kolabFolderType=event)(mail=*)"
"(|(cn=%1)(description=%1)(kolabDescAttribute=%1))"));
const QStringList attrs = QStringList() << mLdapSearchCollections.attributes() << QStringLiteral("uniqueMember");
mLdapSearchCollections.setAttributes(attrs);
mLdapSearch.setAttributes(headers);
connect(&mLdapSearchCollections, qOverload<const KLDAP::LdapResultObject::List &>(&KLDAP :: LdapClientSearch :: searchData), this, &ResourceModel::slotLDAPCollectionData);
connect(&mLdapSearch, qOverload<const KLDAP::LdapResultObject::List &>(&KLDAP :: LdapClientSearch :: searchData), this, &ResourceModel::slotLDAPSearchData);
connect(mLdapSearchCollections, qOverload<const KLDAP::LdapResultObject::List &>(&KLDAP :: LdapClientSearch :: searchData), this, &ResourceModel::slotLDAPCollectionData);
connect(mLdapSearch, qOverload<const KLDAP::LdapResultObject::List &>(&KLDAP :: LdapClientSearch :: searchData), this, &ResourceModel::slotLDAPSearchData);
mLdapSearchCollections.startSearch(QStringLiteral("*"));
mLdapSearchCollections->startSearch(QStringLiteral("*"));
}
ResourceModel::~ResourceModel()
......@@ -165,9 +165,9 @@ void ResourceModel::startSearch()
}
if (mSearchString.isEmpty()) {
mLdapSearch.startSearch(QStringLiteral("*"));
mLdapSearch->startSearch(QStringLiteral("*"));
} else {
mLdapSearch.startSearch(QLatin1Char('*') + mSearchString + QLatin1Char('*'));
mLdapSearch->startSearch(QLatin1Char('*') + mSearchString + QLatin1Char('*'));
}
}
......
......@@ -66,12 +66,12 @@ private:
/* Search for collections of resources
*
*/
KLDAP::LdapClientSearch mLdapSearchCollections;
KLDAP::LdapClientSearch *mLdapSearchCollections = nullptr;
/* Search for matching resources
*
*/
KLDAP::LdapClientSearch mLdapSearch;
KLDAP::LdapClientSearch *mLdapSearch = nullptr;
/* Map from dn of resource -> collectionItem
* A Resource can be part of different collection, so a QMuliMap is needed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment