Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KLDAP
Commits
714842bf
Commit
714842bf
authored
Dec 04, 2020
by
Laurent Montel
😁
Browse files
Add new api for avoiding to call twice readConfig when we change
attribute when we create a new ldapclientsearch
parent
5276ae61
Pipeline
#42967
passed with stage
in 9 minutes and 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
714842bf
cmake_minimum_required
(
VERSION 3.5
)
set
(
PIM_VERSION
"5.16.4
2
"
)
set
(
PIM_VERSION
"5.16.4
3
"
)
project
(
KLdap VERSION
${
PIM_VERSION
}
)
...
...
src/widgets/ldapclientsearch.cpp
View file @
714842bf
...
...
@@ -55,6 +55,7 @@ public:
void
slotLDAPDone
();
void
slotDataTimer
();
void
slotFileChanged
(
const
QString
&
);
void
init
(
const
QStringList
&
attributes
);
LdapClientSearch
*
const
q
;
QList
<
LdapClient
*>
mClients
;
...
...
@@ -71,36 +72,49 @@ public:
LdapClientSearch
::
LdapClientSearch
(
QObject
*
parent
)
:
QObject
(
parent
)
,
d
(
new
Private
(
this
))
{
const
QStringList
attr
{
QStringLiteral
(
"cn"
)
,
QStringLiteral
(
"mail"
)
,
QStringLiteral
(
"givenname"
)
,
QStringLiteral
(
"sn"
)};
d
->
init
(
attr
);
}
LdapClientSearch
::
LdapClientSearch
(
const
QStringList
&
attr
,
QObject
*
parent
)
:
QObject
(
parent
)
,
d
(
new
Private
(
this
))
{
d
->
init
(
attr
);
}
LdapClientSearch
::~
LdapClientSearch
()
{
delete
d
;
}
void
LdapClientSearch
::
Private
::
init
(
const
QStringList
&
attributes
)
{
Kdelibs4ConfigMigrator
migrate
(
QStringLiteral
(
"ldapsettings"
));
migrate
.
setConfigFiles
(
QStringList
()
<<
QStringLiteral
(
"kabldaprc"
));
migrate
.
migrate
();
if
(
!
KProtocolInfo
::
isKnownProtocol
(
QUrl
(
QStringLiteral
(
"ldap://localhost"
))))
{
d
->
mNoLDAPLookup
=
true
;
mNoLDAPLookup
=
true
;
return
;
}
d
->
mAttributes
<<
QStringLiteral
(
"cn"
)
<<
QStringLiteral
(
"mail"
)
<<
QStringLiteral
(
"givenname"
)
<<
QStringLiteral
(
"sn"
);
mAttributes
=
attributes
;
// Set the filter, to make sure old usage (before 4.14) of this object still works.
d
->
mFilter
=
QStringLiteral
(
"&(|(objectclass=person)(objectclass=groupOfNames)(mail=*))"
mFilter
=
QStringLiteral
(
"&(|(objectclass=person)(objectclass=groupOfNames)(mail=*))"
"(|(cn=%1*)(mail=%1*)(givenName=%1*)(sn=%1*))"
);
d
->
readConfig
();
connect
(
KDirWatch
::
self
(),
&
KDirWatch
::
dirty
,
this
,
[
this
](
const
QString
&
filename
)
{
d
->
slotFileChanged
(
filename
);
readConfig
();
q
->
connect
(
KDirWatch
::
self
(),
&
KDirWatch
::
dirty
,
q
,
[
this
](
const
QString
&
filename
)
{
slotFileChanged
(
filename
);
});
}
LdapClientSearch
::~
LdapClientSearch
()
{
delete
d
;
}
void
LdapClientSearch
::
Private
::
readWeighForClient
(
LdapClient
*
client
,
const
KConfigGroup
&
config
,
int
clientNumber
)
{
const
int
completionWeight
=
config
.
readEntry
(
QStringLiteral
(
"SelectedCompletionWeight%1"
).
arg
(
clientNumber
),
-
1
);
...
...
src/widgets/ldapclientsearch.h
View file @
714842bf
...
...
@@ -61,10 +61,18 @@ public:
*/
explicit
LdapClientSearch
(
QObject
*
parent
=
nullptr
);
/**
* Creates a new ldap client search object.
*
* @param attr The attributes.
* @param parent The parent object.
*/
explicit
LdapClientSearch
(
const
QStringList
&
attr
,
QObject
*
parent
=
nullptr
);
/**
* Destroys the ldap client search object.
*/
~
LdapClientSearch
();
~
LdapClientSearch
()
override
;
/**
* Starts the LDAP search on all configured LDAP clients with the given search @p query.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment