Commit f559fc91 authored by Laurent Montel's avatar Laurent Montel 😁

Move QNetworkConfigurationManager in manager class

parent ac710c07
......@@ -41,8 +41,6 @@
#include <ldap/ldapclientsearch.h>
#include <addressline/addresslineedit/baloocompletionemail.h>
#include <akonadi/contact/contactsearchjob.h>
#include <QNetworkConfigurationManager>
static QNetworkConfigurationManager *s_networkConfigMgr = nullptr;
namespace KPIM {
AddresseeLineEditPrivate::AddresseeLineEditPrivate(KPIM::AddresseeLineEdit *qq, bool enableCompletion)
......@@ -64,10 +62,6 @@ AddresseeLineEditPrivate::AddresseeLineEditPrivate(KPIM::AddresseeLineEdit *qq,
, mShowRecentAddresses(true)
, mCanDeleteLineEdit(true)
{
if (!s_networkConfigMgr) {
s_networkConfigMgr = new QNetworkConfigurationManager(QCoreApplication::instance());
}
m_delayedQueryTimer.setSingleShot(true);
connect(&m_delayedQueryTimer, &QTimer::timeout, this, &AddresseeLineEditPrivate::slotTriggerDelayedQueries);
}
......@@ -677,7 +671,7 @@ void AddresseeLineEditPrivate::slotReturnPressed(const QString &)
void AddresseeLineEditPrivate::slotStartLDAPLookup()
{
if (s_networkConfigMgr->isOnline()) {
if (AddresseeLineEditManager::self()->isOnline()) {
const KCompletion::CompletionMode mode = q->completionMode();
if (mode == KCompletion::CompletionNone) {
return;
......
......@@ -23,7 +23,9 @@
#include <Libkdepim/LdapClient>
#include <KLocalizedString>
#include <QNetworkConfigurationManager>
#include <QTimer>
#include <QCoreApplication>
#include <KLDAP/LdapServer>
#include <AkonadiCore/Session>
using namespace KPIM;
......@@ -35,6 +37,7 @@ AddresseeLineEditManager::AddresseeLineEditManager()
, mAddresseeLineEditAkonadi(new AddresseeLineEditAkonadi(this))
, mAddressessLineEditLdap(new AddresseeLineEditLdap(this))
, mAddressessLineEditBaloo(new AddresseeLineEditBaloo(this))
, mNetworkConfigMgr(new QNetworkConfigurationManager(QCoreApplication::instance()))
{
}
......@@ -115,6 +118,11 @@ void AddresseeLineEditManager::setAddressLineEdit(AddresseeLineEdit *addressLine
mAddressessLineEditLdap->setAddressLineEdit(addressLineEdit);
}
bool AddresseeLineEditManager::isOnline() const
{
return mNetworkConfigMgr->isOnline();
}
KLDAP::LdapClientSearch *AddresseeLineEditManager::ldapSearch() const
{
return mAddressessLineEditLdap->ldapSearch();
......
......@@ -28,6 +28,7 @@
#include <ldap/ldapclientsearch.h>
#include <qstringlist.h>
class QTimer;
class QNetworkConfigurationManager;
namespace KPIM {
class KMailCompletion;
class AddresseeLineEdit;
......@@ -107,12 +108,14 @@ public:
AddresseeLineEdit *addressLineEdit() const;
void setAddressLineEdit(AddresseeLineEdit *addressLineEdit);
bool isOnline() const;
private:
KMailCompletion *mCompletion;
AddresseeLineEditAkonadi *mAddresseeLineEditAkonadi;
AddresseeLineEditLdap *mAddressessLineEditLdap;
AddresseeLineEditBaloo *mAddressessLineEditBaloo;
QNetworkConfigurationManager *mNetworkConfigMgr;
};
}
#endif // ADDRESSEELINEEDITSTATIC_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment