Commit 7d8ccf8e authored by Laurent Montel's avatar Laurent Montel 😁

Move ldapClientToCompletionSourceMap in ldap class

parent a6cfbcbe
......@@ -716,12 +716,12 @@ void AddresseeLineEditPrivate::slotLDAPSearchData(const KLDAP::LdapResult::List
}
}
if (!s_static->ldapClientToCompletionSourceMap.contains(result.clientNumber)) {
if (!s_static->isLdapClientToCompletionSourceMapContains(result.clientNumber)) {
s_static->updateLDAPWeights(); // we got results from a new source, so update the completion sources
}
q->addContact(contact, result.completionWeight,
s_static->ldapClientToCompletionSourceMap[ result.clientNumber ], ou);
s_static->ldapClientToCompletionSourceValue(result.clientNumber), ou);
}
if ((q->hasFocus() || q->completionBox()->hasFocus())
......
......@@ -60,6 +60,16 @@ QMap<int, int> AddresseeLineEditLdap::ldapClientToCompletionSourceMap() const
return mLdapClientToCompletionSourceMap;
}
int AddresseeLineEditLdap::ldapClientToCompletionSourceValue(int value) const
{
return mLdapClientToCompletionSourceMap[value];
}
bool AddresseeLineEditLdap::isLdapClientToCompletionSourceMapContains(int value) const
{
return mLdapClientToCompletionSourceMap.contains(value);
}
KLDAP::LdapClientSearch *AddresseeLineEditLdap::ldapSearch() const
{
return mLdapSearch;
......
......@@ -41,6 +41,8 @@ public:
void updateLDAPWeights();
QMap<int, int> ldapClientToCompletionSourceMap() const;
bool isLdapClientToCompletionSourceMapContains(int value) const;
int ldapClientToCompletionSourceValue(int value) const;
KLDAP::LdapClientSearch *ldapSearch() const;
......
......@@ -104,6 +104,16 @@ QTimer *AddresseeLineEditStatic::ldapTimer() const
return mAddressessLineEditLdap->ldapTimer();
}
int AddresseeLineEditStatic::ldapClientToCompletionSourceValue(int value) const
{
return mAddressessLineEditLdap->ldapClientToCompletionSourceValue(value);
}
bool AddresseeLineEditStatic::isLdapClientToCompletionSourceMapContains(int value) const
{
return mAddressessLineEditLdap->isLdapClientToCompletionSourceMapContains(value);
}
int AddresseeLineEditStatic::balooCompletionSource() const
{
return mAddressessLineEditBaloo->balooCompletionSource();
......
......@@ -52,7 +52,6 @@ public:
int addCompletionSource(const QString &source, int weight);
void removeCompletionSource(const QString &source);
Akonadi::Session *akonadiSession();
......@@ -64,10 +63,7 @@ public:
// The weights associated with the completion sources in s_static->completionSources.
// Both are maintained by addCompletionSource(), don't attempt to modifiy those yourself.
QMap<QString, int> completionSourceWeights;
// maps LDAP client indices to completion source indices
// the assumption that they are always the first n indices in s_static->completion
// does not hold when clients are added later on
QMap<int, int> ldapClientToCompletionSourceMap;
// holds the cached mapping from akonadi collection id to the completion source index
struct collectionInfo {
collectionInfo()
......@@ -97,11 +93,16 @@ public:
void setLdapText(const QString &ldapText);
KLDAP::LdapClientSearch *ldapSearch() const;
QTimer *ldapTimer() const;
bool isLdapClientToCompletionSourceMapContains(int value) const;
int ldapClientToCompletionSourceValue(int value) const;
//Baloo
int balooCompletionSource() const;
void setBalooCompletionSource(int value);
//Akonadi
Akonadi::Session *akonadiSession();
private:
AddresseeLineEditAkonadi *mAddresseeLineEditAkonadi;
......
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