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

Don't create multi identitymanager

parent 984cb7e0
......@@ -43,11 +43,11 @@ using namespace KOrg;
SearchCollectionHelper::SearchCollectionHelper(QObject *parent)
: QObject(parent)
, mIdentityManager(/*ro=*/ true)
{
mIdentityManager = KIdentityManagement::IdentityManager::self();
setupSearchCollections();
connect(&mIdentityManager, static_cast<void (KIdentityManagement::IdentityManager::*)()>(&KIdentityManagement::IdentityManager::changed), this, &SearchCollectionHelper::updateOpenInvitation);
connect(&mIdentityManager, static_cast<void (KIdentityManagement::IdentityManager::*)()>(&KIdentityManagement::IdentityManager::changed), this, &SearchCollectionHelper::updateDeclinedInvitation);
connect(mIdentityManager, static_cast<void (KIdentityManagement::IdentityManager::*)()>(&KIdentityManagement::IdentityManager::changed), this, &SearchCollectionHelper::updateOpenInvitation);
connect(mIdentityManager, static_cast<void (KIdentityManagement::IdentityManager::*)()>(&KIdentityManagement::IdentityManager::changed), this, &SearchCollectionHelper::updateDeclinedInvitation);
}
void SearchCollectionHelper::setupSearchCollections()
......@@ -81,7 +81,7 @@ void SearchCollectionHelper::updateSearchCollection(Akonadi::Collection col, KCa
// Update or create search collections
Akonadi::SearchQuery query(Akonadi::SearchTerm::RelOr);
foreach (const QString email, mIdentityManager.allEmails()) {
foreach (const QString email, mIdentityManager->allEmails()) {
if (!email.isEmpty()) {
query.addTerm(Akonadi::IncidenceSearchTerm(Akonadi::IncidenceSearchTerm::PartStatus, QString(email + QString::number(status))));
}
......
......@@ -56,7 +56,7 @@ private:
void updateSearchCollection(Akonadi::Collection col, KCalCore::Attendee::PartStat status, const QString &name, const QString &displayName);
private:
KIdentityManagement::IdentityManager mIdentityManager;
KIdentityManagement::IdentityManager *mIdentityManager;
Akonadi::Collection mOpenInvitationCollection;
Akonadi::Collection mDeclineCollection;
};
......
......@@ -44,7 +44,7 @@ KOCore *KOCore::self()
}
KOCore::KOCore()
: mCalendarDecorationsLoaded(false), mIdentityManager(Q_NULLPTR)
: mCalendarDecorationsLoaded(false)
{
}
......@@ -301,8 +301,5 @@ void KOCore::reloadPlugins()
KIdentityManagement::IdentityManager *KOCore::identityManager()
{
if (!mIdentityManager) {
mIdentityManager = new CalendarSupport::IdentityManager;
}
return mIdentityManager;
return CalendarSupport::IdentityManager::self();
}
......@@ -97,8 +97,6 @@ private:
bool mCalendarDecorationsLoaded;
QMap<QWidget *, KXMLGUIClient *> mXMLGUIClients;
KIdentityManagement::IdentityManager *mIdentityManager;
};
#endif
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