Commit 17e27b79 authored by Laurent Montel's avatar Laurent Montel 😁

Rename class

parent 7d8ccf8e
......@@ -18,7 +18,7 @@ set(kdepim_addressline_LIB_SRCS
addressline/completionorder/completionorderwidget.cpp
addressline/addresslineedit/addresseelineedit.cpp
addressline/addresslineedit/addresseelineedit_p.cpp
addressline/addresslineedit/addresseelineeditstatic.cpp
addressline/addresslineedit/addresseelineeditmanager.cpp
addressline/addresslineedit/addresseelineeditldap.cpp
addressline/addresslineedit/addresseelineeditakonadi.cpp
addressline/addresslineedit/addresseelineeditbaloo.cpp
......
......@@ -39,7 +39,6 @@
#include <KEmailAddress>
#include <KColorScheme>
#include <KJobWidgets>
#include <kdelibs4configmigrator.h>
#include <kcontacts/contactgrouptool.h>
#include <KIO/StoredTransferJob>
#include <Akonadi/Contact/ContactGroupExpandJob>
......
......@@ -22,7 +22,7 @@
using namespace KPIM;
AddresseeLineEditAkonadi::AddresseeLineEditAkonadi(AddresseeLineEditStatic *addressLineStatic)
AddresseeLineEditAkonadi::AddresseeLineEditAkonadi(AddresseeLineEditManager *addressLineStatic)
: mAddressLineStatic(addressLineStatic)
{
......
......@@ -25,18 +25,18 @@ class Session;
}
namespace KPIM {
class AddresseeLineEditStatic;
class AddresseeLineEditManager;
class AddresseeLineEditAkonadi
{
public:
explicit AddresseeLineEditAkonadi(AddresseeLineEditStatic *addressLineStatic);
explicit AddresseeLineEditAkonadi(AddresseeLineEditManager *addressLineStatic);
~AddresseeLineEditAkonadi();
Akonadi::Session *akonadiSession();
private:
Akonadi::Session *m_akonadiSession;
AddresseeLineEditStatic *mAddressLineStatic;
AddresseeLineEditManager *mAddressLineStatic;
};
}
......
......@@ -21,7 +21,7 @@
using namespace KPIM;
AddresseeLineEditBaloo::AddresseeLineEditBaloo(AddresseeLineEditStatic *addressLineStatic)
AddresseeLineEditBaloo::AddresseeLineEditBaloo(AddresseeLineEditManager *addressLineStatic)
: mBalooCompletionSource(0)
, mAddressLineStatic(addressLineStatic)
{
......
......@@ -21,11 +21,11 @@
#define ADDRESSEELINEEDITBALOO_H
namespace KPIM {
class AddresseeLineEditStatic;
class AddresseeLineEditManager;
class AddresseeLineEditBaloo
{
public:
explicit AddresseeLineEditBaloo(AddresseeLineEditStatic *addressLineStatic);
explicit AddresseeLineEditBaloo(AddresseeLineEditManager *addressLineStatic);
~AddresseeLineEditBaloo();
int balooCompletionSource() const;
......@@ -33,7 +33,7 @@ public:
private:
int mBalooCompletionSource;
AddresseeLineEditStatic *mAddressLineStatic;
AddresseeLineEditManager *mAddressLineStatic;
};
}
......
......@@ -18,7 +18,7 @@
*/
#include "addresseelineeditldap.h"
#include "addresseelineeditstatic.h"
#include "addresseelineeditmanager.h"
#include <Libkdepim/LdapClientSearch>
#include <Libkdepim/LdapClient>
#include <KLDAP/LdapServer>
......@@ -26,7 +26,7 @@
using namespace KPIM;
AddresseeLineEditLdap::AddresseeLineEditLdap(AddresseeLineEditStatic *addressLineStatic, QObject *parent)
AddresseeLineEditLdap::AddresseeLineEditLdap(AddresseeLineEditManager *addressLineStatic, QObject *parent)
: QObject(parent)
, mLdapTimer(nullptr)
, mLdapSearch(nullptr)
......
......@@ -29,11 +29,11 @@ class LdapClientSearch;
}
namespace KPIM {
class AddresseeLineEditStatic;
class AddresseeLineEditManager;
class AddresseeLineEditLdap : public QObject
{
public:
explicit AddresseeLineEditLdap(AddresseeLineEditStatic *addressLineStatic, QObject *parent = nullptr);
explicit AddresseeLineEditLdap(AddresseeLineEditManager *addressLineStatic, QObject *parent = nullptr);
~AddresseeLineEditLdap();
void init();
......@@ -59,7 +59,7 @@ private:
QTimer *mLdapTimer;
KLDAP::LdapClientSearch *mLdapSearch;
AddresseeLineEditStatic *mAddressLineStatic;
AddresseeLineEditManager *mAddressLineStatic;
};
}
......
......@@ -15,7 +15,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "addresseelineeditstatic.h"
#include "addresseelineeditmanager.h"
#include "addresseelineeditakonadi.h"
#include "addresseelineeditbaloo.h"
#include "addresseelineeditldap.h"
......@@ -28,41 +28,48 @@
#include <AkonadiCore/Session>
using namespace KPIM;
AddresseeLineEditStatic::AddresseeLineEditStatic()
: completion(new KMailCompletion)
, addressLineEdit(nullptr)
Q_GLOBAL_STATIC(AddresseeLineEditManager, sInstance)
AddresseeLineEditManager::AddresseeLineEditManager()
: addressLineEdit(nullptr)
, mCompletion(new KMailCompletion)
, mAddresseeLineEditAkonadi(new AddresseeLineEditAkonadi(this))
, mAddressessLineEditLdap(new AddresseeLineEditLdap(this))
, mAddressessLineEditBaloo(new AddresseeLineEditBaloo(this))
{
}
AddresseeLineEditStatic::~AddresseeLineEditStatic()
AddresseeLineEditManager::~AddresseeLineEditManager()
{
delete completion;
delete mCompletion;
delete mAddresseeLineEditAkonadi;
delete mAddressessLineEditLdap;
delete mAddressessLineEditBaloo;
}
void AddresseeLineEditStatic::updateCompletionOrder()
AddresseeLineEditManager *AddresseeLineEditManager::self()
{
return sInstance;
}
void AddresseeLineEditManager::updateCompletionOrder()
{
updateLDAPWeights();
updateCollectionWeights();
}
void AddresseeLineEditStatic::updateCollectionWeights()
void AddresseeLineEditManager::updateCollectionWeights()
{
akonadiCollectionToCompletionSourceMap.clear();
}
void AddresseeLineEditStatic::updateLDAPWeights()
void AddresseeLineEditManager::updateLDAPWeights()
{
mAddressessLineEditLdap->updateLDAPWeights();
}
int AddresseeLineEditStatic::addCompletionSource(const QString &source, int weight)
int AddresseeLineEditManager::addCompletionSource(const QString &source, int weight)
{
QMap<QString, int>::iterator it = completionSourceWeights.find(source);
if (it == completionSourceWeights.end()) {
......@@ -80,61 +87,66 @@ int AddresseeLineEditStatic::addCompletionSource(const QString &source, int weig
}
}
void AddresseeLineEditStatic::removeCompletionSource(const QString &source)
void AddresseeLineEditManager::removeCompletionSource(const QString &source)
{
QMap<QString, int>::iterator it = completionSourceWeights.find(source);
if (it != completionSourceWeights.end()) {
completionSourceWeights.remove(source);
completion->clear();
mCompletion->clear();
}
}
Akonadi::Session *AddresseeLineEditStatic::akonadiSession()
Akonadi::Session *AddresseeLineEditManager::akonadiSession()
{
return mAddresseeLineEditAkonadi->akonadiSession();
}
KLDAP::LdapClientSearch *AddresseeLineEditStatic::ldapSearch() const
KMailCompletion *AddresseeLineEditManager::completion() const
{
return mCompletion;
}
KLDAP::LdapClientSearch *AddresseeLineEditManager::ldapSearch() const
{
return mAddressessLineEditLdap->ldapSearch();
}
QTimer *AddresseeLineEditStatic::ldapTimer() const
QTimer *AddresseeLineEditManager::ldapTimer() const
{
return mAddressessLineEditLdap->ldapTimer();
}
int AddresseeLineEditStatic::ldapClientToCompletionSourceValue(int value) const
int AddresseeLineEditManager::ldapClientToCompletionSourceValue(int value) const
{
return mAddressessLineEditLdap->ldapClientToCompletionSourceValue(value);
}
bool AddresseeLineEditStatic::isLdapClientToCompletionSourceMapContains(int value) const
bool AddresseeLineEditManager::isLdapClientToCompletionSourceMapContains(int value) const
{
return mAddressessLineEditLdap->isLdapClientToCompletionSourceMapContains(value);
}
int AddresseeLineEditStatic::balooCompletionSource() const
int AddresseeLineEditManager::balooCompletionSource() const
{
return mAddressessLineEditBaloo->balooCompletionSource();
}
void AddresseeLineEditStatic::setBalooCompletionSource(int value)
void AddresseeLineEditManager::setBalooCompletionSource(int value)
{
mAddressessLineEditBaloo->setBalooCompletionSource(value);
}
void AddresseeLineEditStatic::initializeLdap()
void AddresseeLineEditManager::initializeLdap()
{
mAddressessLineEditLdap->init();
}
QString AddresseeLineEditStatic::ldapText() const
QString AddresseeLineEditManager::ldapText() const
{
return mAddressessLineEditLdap->ldapText();
}
void AddresseeLineEditStatic::setLdapText(const QString &ldapText)
void AddresseeLineEditManager::setLdapText(const QString &ldapText)
{
mAddressessLineEditLdap->setLdapText(ldapText);
}
......
......@@ -34,15 +34,16 @@ class AddresseeLineEdit;
class AddresseeLineEditAkonadi;
class AddresseeLineEditLdap;
class AddresseeLineEditBaloo;
class AddresseeLineEditStatic
class AddresseeLineEditManager
{
public:
typedef QMap< QString, QPair<int, int> > CompletionItemsMap;
AddresseeLineEditStatic();
AddresseeLineEditManager();
~AddresseeLineEditStatic();
~AddresseeLineEditManager();
static AddresseeLineEditManager *self();
void updateCollectionWeights();
......@@ -55,7 +56,6 @@ public:
KMailCompletion *completion;
CompletionItemsMap completionItemMap;
QStringList completionSources;
......@@ -103,8 +103,10 @@ public:
//Akonadi
Akonadi::Session *akonadiSession();
KMailCompletion *completion() const;
private:
KMailCompletion *mCompletion;
AddresseeLineEditAkonadi *mAddresseeLineEditAkonadi;
AddresseeLineEditLdap *mAddressessLineEditLdap;
AddresseeLineEditBaloo *mAddressessLineEditBaloo;
......
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