Commit f75d6edb authored by chriadam's avatar chriadam

Merge branch 'jb44707-core-apps' into 'master'

[libcontacts] Replace name group with display label group. Contributes to JB#44742

See merge request mer-core/libcontacts!8
parents 7a6dfca5 9deb603a
This diff is collapsed.
......@@ -34,7 +34,6 @@
#include "contactcacheexport.h"
#include "cacheconfiguration.h"
#include "seasidenamegrouper.h"
#include <qtcontacts-extensions.h>
#include <QContactStatusFlags>
......@@ -62,13 +61,13 @@
QTCONTACTS_USE_NAMESPACE
class CONTACTCACHE_EXPORT SeasideNameGroupChangeListener
class CONTACTCACHE_EXPORT SeasideDisplayLabelGroupChangeListener
{
public:
SeasideNameGroupChangeListener() {}
~SeasideNameGroupChangeListener() {}
SeasideDisplayLabelGroupChangeListener() {}
~SeasideDisplayLabelGroupChangeListener() {}
virtual void nameGroupsUpdated(const QHash<QString, QSet<quint32> > &groups) = 0;
virtual void displayLabelGroupsUpdated(const QHash<QString, QSet<quint32> > &groups) = 0;
};
class CONTACTCACHE_EXPORT SeasideCache : public QObject
......@@ -200,7 +199,7 @@ public:
quint64 statusFlags;
ContactState contactState;
ItemListener *listeners;
QString nameGroup;
QString displayLabelGroup;
QString displayLabel;
};
......@@ -267,16 +266,14 @@ public:
static void registerUser(QObject *user);
static void unregisterUser(QObject *user);
static void registerNameGroupChangeListener(SeasideNameGroupChangeListener *listener);
static void unregisterNameGroupChangeListener(SeasideNameGroupChangeListener *listener);
static void registerDisplayLabelGroupChangeListener(SeasideDisplayLabelGroupChangeListener *listener);
static void unregisterDisplayLabelGroupChangeListener(SeasideDisplayLabelGroupChangeListener *listener);
static void registerChangeListener(ChangeListener *listener);
static void unregisterChangeListener(ChangeListener *listener);
static void unregisterResolveListener(ResolveListener *listener);
static void setNameGrouper(SeasideNameGrouper *grouper);
static DisplayLabelOrder displayLabelOrder();
static QString sortProperty();
static QString groupProperty();
......@@ -293,11 +290,9 @@ public:
static void ensureCompletion(CacheItem *cacheItem);
static void refreshContact(CacheItem *cacheItem);
static QString nameGroup(const CacheItem *cacheItem);
static QString determineNameGroup(const CacheItem *cacheItem);
static QStringList allNameGroups();
static QHash<QString, QSet<quint32> > nameGroupMembers();
static QString displayLabelGroup(const CacheItem *cacheItem);
static QStringList allDisplayLabelGroups();
static QHash<QString, QSet<quint32> > displayLabelGroupMembers();
static CacheItem *itemByPhoneNumber(const QString &number, bool requireComplete = true);
static CacheItem *itemByEmailAddress(const QString &address, bool requireComplete = true);
......@@ -355,6 +350,7 @@ private slots:
void contactsChanged(const QList<QContactId> &contactIds);
void contactsPresenceChanged(const QList<QContactId> &contactIds);
void contactsRemoved(const QList<QContactId> &contactIds);
void displayLabelGroupsChanged(const QStringList &groups);
void displayLabelOrderChanged(CacheConfiguration::DisplayLabelOrder order);
void sortPropertyChanged(const QString &sortProperty);
void groupPropertyChanged(const QString &groupProperty);
......@@ -396,9 +392,9 @@ private:
void removeContactData(quint32 iid, FilterType filter);
void makePopulated(FilterType filter);
void addToContactNameGroup(quint32 iid, const QString &group, QSet<QString> *modifiedGroups = 0);
void removeFromContactNameGroup(quint32 iid, const QString &group, QSet<QString> *modifiedGroups = 0);
void notifyNameGroupsChanged(const QSet<QString> &groups);
void addToContactDisplayLabelGroup(quint32 iid, const QString &group, QSet<QString> *modifiedGroups = 0);
void removeFromContactDisplayLabelGroup(quint32 iid, const QString &group, QSet<QString> *modifiedGroups = 0);
void notifyDisplayLabelGroupsChanged(const QSet<QString> &groups);
void updateConstituentAggregations(const QContactId &contactId);
void completeContactAggregation(const QContactId &contact1Id, const QContactId &contact2Id);
......@@ -421,7 +417,7 @@ private:
QHash<QString, quint32> m_emailAddressIds;
QHash<QPair<QString, QString>, quint32> m_onlineAccountIds;
QHash<QContactId, QContact> m_contactsToSave;
QHash<QString, QSet<quint32> > m_contactNameGroups;
QHash<QString, QSet<quint32> > m_contactDisplayLabelGroups;
QList<QContact> m_contactsToCreate;
QHash<FilterType, QPair<QSet<QContactDetail::DetailType>, QList<QContact> > > m_contactsToAppend;
QList<QPair<QSet<QContactDetail::DetailType>, QList<QContact> > > m_contactsToUpdate;
......@@ -435,8 +431,7 @@ private:
QList<QPair<ContactLinkRequest, ContactLinkRequest> > m_contactPairsToLink;
QList<QContactRelationship> m_relationshipsToSave;
QList<QContactRelationship> m_relationshipsToRemove;
QScopedPointer<SeasideNameGrouper> m_nameGrouper;
QList<SeasideNameGroupChangeListener*> m_nameGroupChangeListeners;
QList<SeasideDisplayLabelGroupChangeListener*> m_displayLabelGroupChangeListeners;
QList<ChangeListener*> m_changeListeners;
QList<ListModel *> m_models[FilterTypesCount];
QSet<QObject *> m_users;
......@@ -490,8 +485,8 @@ private:
QElapsedTimer m_fetchPostponed;
static SeasideCache *instancePtr;
static int contactNameGroupCount;
static QStringList allContactNameGroups;
static int contactDisplayLabelGroupCount;
static QStringList allContactDisplayLabelGroups;
static QTranslator *engEnTranslator;
static QTranslator *translator;
......
/*
* Copyright (C) 2013 Jolla Mobile <michael.brasser@jollamobile.com>
*
* You may use this file under the terms of the BSD license as follows:
*
* "Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Nemo Mobile nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
*/
#ifndef SEASIDENAMEGROUPER_H
#define SEASIDENAMEGROUPER_H
#include "contactcacheexport.h"
#include <QList>
#include <QContact>
QTCONTACTS_USE_NAMESPACE
class CONTACTCACHE_EXPORT SeasideNameGrouper
{
public:
SeasideNameGrouper() {}
virtual ~SeasideNameGrouper() {}
virtual QString nameGroupForContact(const QContact &contact, const QString &groupProperty) const = 0;
virtual QStringList allNameGroups() const = 0;
};
#endif // SEASIDENAMEGROUPER_H
......@@ -21,7 +21,7 @@ packagesExist(mlite5) {
} else {
warning("mlite not available. Some functionality may not work as expected.")
}
PKGCONFIG += mlocale5 mce
PKGCONFIG += mlocale5 mce qtcontacts-sqlite-qt5-extensions
DEFINES += CONTACTCACHE_BUILD
......@@ -49,7 +49,6 @@ HEADERS += \
$$PWD/seasideimport.h \
$$PWD/seasidecontactbuilder.h \
$$PWD/synchronizelists.h \
$$PWD/seasidenamegrouper.h \
$$PWD/seasidepropertyhandler.h
headers.files = \
......@@ -60,7 +59,6 @@ headers.files = \
$$PWD/seasideimport.h \
$$PWD/seasidecontactbuilder.h \
$$PWD/synchronizelists.h \
$$PWD/seasidenamegrouper.h \
$$PWD/seasidepropertyhandler.h
headers.path = $$PREFIX/include/$$TARGET
INSTALLS += headers
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