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
274ab848
Commit
274ab848
authored
Dec 01, 2020
by
Laurent Montel
😁
Browse files
Prepare to restore settings as async
parent
64d753ba
Pipeline
#42638
canceled with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
274ab848
...
...
@@ -15,6 +15,7 @@ set(accountwizard_srcs
transport.cpp
configfile.cpp
ldap.cpp
restoreldapsettingsjob.cpp
identity.cpp
setupispdb.cpp
setupautoconfigkolabmail.cpp
...
...
src/ldap.cpp
View file @
274ab848
...
...
@@ -72,7 +72,7 @@ void Ldap::create()
KConfig
*
c
=
config
();
KConfigGroup
group
=
c
->
group
(
QStringLiteral
(
"LDAP"
));
bool
hasMyServer
=
false
;
int
selHosts
=
group
.
readEntry
(
"NumSelectedHosts"
,
0
);
const
int
selHosts
=
group
.
readEntry
(
"NumSelectedHosts"
,
0
);
for
(
int
i
=
0
;
i
<
selHosts
&&
!
hasMyServer
;
++
i
)
{
if
(
group
.
readEntry
(
QStringLiteral
(
"SelectedHost%1"
).
arg
(
i
),
QString
())
==
host
)
{
hasMyServer
=
true
;
...
...
@@ -136,8 +136,8 @@ void Ldap::destroy()
if
(
m_entry
>=
0
)
{
KConfig
*
c
=
config
();
KConfigGroup
group
=
c
->
group
(
QStringLiteral
(
"LDAP"
));
int
cSelHosts
=
group
.
readEntry
(
QStringLiteral
(
"NumSelectedHosts"
),
0
);
int
cHosts
=
group
.
readEntry
(
QStringLiteral
(
"NumHosts"
),
0
);
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
)
{
...
...
src/restoreldapsettingsjob.cpp
0 → 100644
View file @
274ab848
/*
SPDX-FileCopyrightText: 2010-2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "restoreldapsettingsjob.h"
#include <KLDAP/LdapClientSearchConfigWriteConfigJob>
#include <KConfigGroup>
#include <KConfig>
#include <QDebug>
RestoreLdapSettingsJob
::
RestoreLdapSettingsJob
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
RestoreLdapSettingsJob
::~
RestoreLdapSettingsJob
()
{
}
void
RestoreLdapSettingsJob
::
start
()
{
if
(
!
canStart
())
{
deleteLater
();
qWarning
()
<<
"Impossible to start RestoreLdapSettingsJob"
;
Q_EMIT
restoreDone
();
return
;
}
//TODO
deleteLater
();
}
KConfig
*
RestoreLdapSettingsJob
::
config
()
const
{
return
mConfig
;
}
void
RestoreLdapSettingsJob
::
setConfig
(
KConfig
*
config
)
{
mConfig
=
config
;
}
bool
RestoreLdapSettingsJob
::
canStart
()
const
{
return
(
mConfig
!=
nullptr
);
}
src/restoreldapsettingsjob.h
0 → 100644
View file @
274ab848
/*
SPDX-FileCopyrightText: 2010-2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef RESTORELDAPSETTINGSJOB_H
#define RESTORELDAPSETTINGSJOB_H
#include <QObject>
#include <KLDAP/LdapServer>
class
KConfig
;
class
RestoreLdapSettingsJob
:
public
QObject
{
Q_OBJECT
public:
explicit
RestoreLdapSettingsJob
(
QObject
*
parent
=
nullptr
);
~
RestoreLdapSettingsJob
()
override
;
void
start
();
KConfig
*
config
()
const
;
void
setConfig
(
KConfig
*
config
);
Q_REQUIRED_RESULT
bool
canStart
()
const
;
Q_SIGNALS:
void
restoreDone
();
private:
QVector
<
KLDAP
::
LdapServer
>
mSelHosts
;
QVector
<
KLDAP
::
LdapServer
>
mHosts
;
KConfig
*
mConfig
=
nullptr
;
};
#endif // RESTORELDAPSETTINGSJOB_H
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