File indexing completed on 2025-01-26 04:52:16

0001 /*
0002  * SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #include "ldapwidgetitemreadconfigserverjob.h"
0008 #include "ldapclientsearchconfigreadconfigjob.h"
0009 #include "ldapwidgetitem_p.h"
0010 using namespace KLDAPWidgets;
0011 LdapWidgetItemReadConfigServerJob::LdapWidgetItemReadConfigServerJob(QObject *parent)
0012     : QObject(parent)
0013 {
0014 }
0015 
0016 LdapWidgetItemReadConfigServerJob::~LdapWidgetItemReadConfigServerJob() = default;
0017 
0018 void LdapWidgetItemReadConfigServerJob::start()
0019 {
0020     auto job = new LdapClientSearchConfigReadConfigJob(this);
0021     connect(job, &LdapClientSearchConfigReadConfigJob::configLoaded, this, &LdapWidgetItemReadConfigServerJob::slotConfigLoaded);
0022     job->setActive(mActive);
0023     job->setConfig(mConfig);
0024     job->setServerIndex(mCurrentIndex);
0025     job->start();
0026 }
0027 
0028 void LdapWidgetItemReadConfigServerJob::slotConfigLoaded(const KLDAPCore::LdapServer &server)
0029 {
0030     mLdapWidgetItem->setServer(server);
0031     deleteLater();
0032 }
0033 
0034 LdapWidgetItem *LdapWidgetItemReadConfigServerJob::ldapWidgetItem() const
0035 {
0036     return mLdapWidgetItem;
0037 }
0038 
0039 void LdapWidgetItemReadConfigServerJob::setLdapWidgetItem(LdapWidgetItem *ldapWidgetItem)
0040 {
0041     mLdapWidgetItem = ldapWidgetItem;
0042 }
0043 
0044 int LdapWidgetItemReadConfigServerJob::currentIndex() const
0045 {
0046     return mCurrentIndex;
0047 }
0048 
0049 void LdapWidgetItemReadConfigServerJob::setCurrentIndex(int currentIndex)
0050 {
0051     mCurrentIndex = currentIndex;
0052 }
0053 
0054 bool LdapWidgetItemReadConfigServerJob::active() const
0055 {
0056     return mActive;
0057 }
0058 
0059 void LdapWidgetItemReadConfigServerJob::setActive(bool active)
0060 {
0061     mActive = active;
0062 }
0063 
0064 KConfigGroup LdapWidgetItemReadConfigServerJob::config() const
0065 {
0066     return mConfig;
0067 }
0068 
0069 void LdapWidgetItemReadConfigServerJob::setConfig(const KConfigGroup &config)
0070 {
0071     mConfig = config;
0072 }
0073 
0074 #include "moc_ldapwidgetitemreadconfigserverjob.cpp"