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
KMail Account Wizard
Commits
5a1a9389
Commit
5a1a9389
authored
Dec 03, 2020
by
Laurent Montel
😁
Browse files
Continue to implement async method
parent
323b7c60
Pipeline
#42856
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/restoreldapsettingsjob.cpp
View file @
5a1a9389
...
...
@@ -39,49 +39,54 @@ void RestoreLdapSettingsJob::restore()
KConfigGroup
group
=
mConfig
->
group
(
QStringLiteral
(
"LDAP"
));
const
int
cSelHosts
=
group
.
readEntry
(
QStringLiteral
(
"NumSelectedHosts"
),
0
);
const
int
cHosts
=
group
.
readEntry
(
QStringLiteral
(
"NumHosts"
),
0
);
QVector
<
KLDAP
::
LdapServer
>
selHosts
;
QVector
<
KLDAP
::
LdapServer
>
hosts
;
for
(
int
i
=
0
;
i
<
cSelHosts
;
++
i
)
{
if
(
i
!=
mEntry
)
{
KLDAP
::
LdapServer
server
;
mClientSearchConfig
->
readConfig
(
server
,
group
,
i
,
true
);
s
elHosts
.
append
(
server
);
mS
elHosts
.
append
(
server
);
}
}
h
osts
.
reserve
(
cHosts
);
mH
osts
.
reserve
(
cHosts
);
for
(
int
i
=
0
;
i
<
cHosts
;
++
i
)
{
KLDAP
::
LdapServer
server
;
mClientSearchConfig
->
readConfig
(
server
,
group
,
i
,
false
);
h
osts
.
append
(
server
);
mH
osts
.
append
(
server
);
}
mConfig
->
deleteGroup
(
QStringLiteral
(
"LDAP"
));
group
=
KConfigGroup
(
mConfig
,
QStringLiteral
(
"LDAP"
));
for
(
int
i
=
0
;
i
<
cSelHosts
-
1
;
++
i
)
{
auto
job
=
new
KLDAP
::
LdapClientSearchConfigWriteConfigJob
;
job
->
setActive
(
true
);
job
->
setConfig
(
group
);
job
->
setServer
(
selHosts
.
at
(
i
));
job
->
setServerIndex
(
i
);
job
->
start
();
}
saveLdapSettings
(
cSelHosts
,
cHosts
);
}
else
{
Q_EMIT
restoreDone
();
deleteLater
();
}
}
for
(
int
i
=
0
;
i
<
cHosts
;
++
i
)
{
auto
job
=
new
KLDAP
::
LdapClientSearchConfigWriteConfigJob
;
job
->
setActive
(
false
);
job
->
setConfig
(
group
);
job
->
setServer
(
hosts
.
at
(
i
));
job
->
setServerIndex
(
i
);
job
->
start
();
}
void
RestoreLdapSettingsJob
::
saveLdapSettings
(
int
cSelHosts
,
int
cHosts
)
{
mConfig
->
deleteGroup
(
QStringLiteral
(
"LDAP"
));
KConfigGroup
group
=
KConfigGroup
(
mConfig
,
QStringLiteral
(
"LDAP"
));
for
(
int
i
=
0
;
i
<
cSelHosts
-
1
;
++
i
)
{
auto
job
=
new
KLDAP
::
LdapClientSearchConfigWriteConfigJob
;
job
->
setActive
(
true
);
job
->
setConfig
(
group
);
job
->
setServer
(
mSelHosts
.
at
(
i
));
job
->
setServerIndex
(
i
);
job
->
start
();
}
group
.
writeEntry
(
QStringLiteral
(
"NumSelectedHosts"
),
cSelHosts
-
1
);
group
.
writeEntry
(
QStringLiteral
(
"NumHosts"
),
cHosts
);
mConfig
->
sync
();
Q_EMIT
restoreDone
();
for
(
int
i
=
0
;
i
<
cHosts
;
++
i
)
{
auto
job
=
new
KLDAP
::
LdapClientSearchConfigWriteConfigJob
;
job
->
setActive
(
false
);
job
->
setConfig
(
group
);
job
->
setServer
(
mHosts
.
at
(
i
));
job
->
setServerIndex
(
i
);
job
->
start
();
}
//TODO
group
.
writeEntry
(
QStringLiteral
(
"NumSelectedHosts"
),
cSelHosts
-
1
);
group
.
writeEntry
(
QStringLiteral
(
"NumHosts"
),
cHosts
);
mConfig
->
sync
();
Q_EMIT
restoreDone
();
deleteLater
();
}
...
...
src/restoreldapsettingsjob.h
View file @
5a1a9389
...
...
@@ -34,6 +34,7 @@ Q_SIGNALS:
void
restoreDone
();
private:
void
restore
();
void
saveLdapSettings
(
int
cSelHosts
,
int
cHosts
);
QVector
<
KLDAP
::
LdapServer
>
mSelHosts
;
QVector
<
KLDAP
::
LdapServer
>
mHosts
;
int
mEntry
=
-
1
;
...
...
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