From 8549b46193b19d9eda5a6dbd7ec6fe2ef5db47e1 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Fri, 4 Jan 2019 21:39:46 +0100 Subject: [PATCH] Indeed configure ldap is more useful in kmail as in kaddressbook --- CMakeLists.txt | 2 +- src/configuredialog/configureaccountpage.cpp | 40 +++++++++++++++++++- src/configuredialog/configureaccountpage.h | 24 +++++++++++- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6394a2fe4..1738bdeef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ set(KDEPIM_APPS_LIB_VERSION_LIB "5.10.40") set(MESSAGELIB_LIB_VERSION_LIB "5.10.45") set(LIBKLEO_LIB_VERSION_LIB "5.10.40") set(PIMCOMMON_LIB_VERSION_LIB "5.10.41") -set(LIBKDEPIM_LIB_VERSION_LIB "5.10.40") +set(LIBKDEPIM_LIB_VERSION_LIB "5.10.41") set(LIBKSIEVE_LIB_VERSION_LIB "5.10.40") find_package(KF5WebEngineViewer ${MESSAGELIB_LIB_VERSION_LIB} CONFIG REQUIRED) diff --git a/src/configuredialog/configureaccountpage.cpp b/src/configuredialog/configureaccountpage.cpp index a55ca7bad..92a389f2a 100644 --- a/src/configuredialog/configureaccountpage.cpp +++ b/src/configuredialog/configureaccountpage.cpp @@ -37,7 +37,7 @@ using MailTransport::TransportManagementWidget; #include #include #include - +#include #include #include #include @@ -76,6 +76,12 @@ AccountsPage::AccountsPage(QWidget *parent) // SendingTab *sendingTab = new SendingTab(); addTab(sendingTab, i18nc("@title:tab Tab page where the user configures accounts to send mail", "Sending")); + + // + // "Sending" tab: + // + LdapCompetionTab *ldapCompletionTab = new LdapCompetionTab(); + addTab(ldapCompletionTab, i18nc("@title:tab Tab page where the user configures ldap server", "LDAP server")); } AccountsPageSendingTab::~AccountsPageSendingTab() @@ -379,3 +385,35 @@ void AccountsPage::ReceivingTab::save() delete conf; } } + +LdapCompetionTab::LdapCompetionTab(QWidget *parent) + : ConfigModuleTab(parent) +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setMargin(0); + + mLdapConfigureWidget = new KLDAP::LdapConfigureWidget(this); + layout->addWidget(mLdapConfigureWidget); + + connect(mLdapConfigureWidget, &KLDAP::LdapConfigureWidget::changed, this, QOverload::of(&LdapCompetionTab::changed)); +} + +LdapCompetionTab::~LdapCompetionTab() +{ + +} + +QString LdapCompetionTab::helpAnchor() const +{ + return {}; +} + +void LdapCompetionTab::save() +{ + mLdapConfigureWidget->save(); +} + +void LdapCompetionTab::doLoadOther() +{ + mLdapConfigureWidget->load(); +} diff --git a/src/configuredialog/configureaccountpage.h b/src/configuredialog/configureaccountpage.h index 708ac981c..c97e60943 100644 --- a/src/configuredialog/configureaccountpage.h +++ b/src/configuredialog/configureaccountpage.h @@ -25,7 +25,10 @@ class QCheckBox; class KComboBox; class OrgFreedesktopAkonadiNewMailNotifierInterface; - +namespace KLDAP +{ +class LdapConfigureWidget; +} // subclasses: one class per tab: class AccountsPageSendingTab : public ConfigModuleTab { @@ -47,12 +50,29 @@ private: KComboBox *mSendMethodCombo = nullptr; }; +// subclasses: one class per tab: +class LdapCompetionTab : public ConfigModuleTab +{ + Q_OBJECT +public: + explicit LdapCompetionTab(QWidget *parent = nullptr); + ~LdapCompetionTab() override; + QString helpAnchor() const; + void save() override; + +private: + void doLoadOther() override; + +private: + KLDAP::LdapConfigureWidget *mLdapConfigureWidget = nullptr; +}; + class AccountsPageReceivingTab : public ConfigModuleTab { Q_OBJECT public: explicit AccountsPageReceivingTab(QWidget *parent = nullptr); - ~AccountsPageReceivingTab(); + ~AccountsPageReceivingTab() override; QString helpAnchor() const; void save() override;