Skip to content

Commit

Permalink
[nemo-qml-plugin-contacts] Remove Qt4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvogt committed Jan 28, 2014
1 parent 10f1a33 commit f5be813
Show file tree
Hide file tree
Showing 25 changed files with 41 additions and 418 deletions.
14 changes: 1 addition & 13 deletions config.pri
@@ -1,15 +1,3 @@
include(contacts-namespace.pri)

CONFIG += link_pkgconfig

equals(QT_MAJOR_VERSION, 4) {
CONFIG += mobility
MOBILITY += contacts versit
PKGCONFIG += qtcontacts-sqlite-extensions
}
equals(QT_MAJOR_VERSION, 5) {
PKGCONFIG += Qt5Contacts Qt5Versit qtcontacts-sqlite-qt5-extensions

# Needed for qt4 moc, which can't handle numeric tests
DEFINES *= QT_VERSION_5
}
PKGCONFIG += Qt5Contacts Qt5Versit qtcontacts-sqlite-qt5-extensions
18 changes: 0 additions & 18 deletions contacts-namespace.pri

This file was deleted.

92 changes: 0 additions & 92 deletions rpm/nemo-qml-plugin-contacts.spec

This file was deleted.

43 changes: 0 additions & 43 deletions rpm/nemo-qml-plugin-contacts.yaml

This file was deleted.

17 changes: 2 additions & 15 deletions src/plugin.cpp
Expand Up @@ -31,31 +31,22 @@

#include <QtGlobal>

#ifdef QT_VERSION_5
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
#define QDeclarativeEngine QQmlEngine
#define QDeclarativeExtensionPlugin QQmlExtensionPlugin
#else
#include <QDeclarativeEngine>
#include <QDeclarativeExtensionPlugin>
#endif

#include "seasideperson.h"
#include "seasidefilteredmodel.h"
#include "seasidenamegroupmodel.h"

class Q_DECL_EXPORT NemoContactsPlugin : public QDeclarativeExtensionPlugin
class Q_DECL_EXPORT NemoContactsPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
#ifdef QT_VERSION_5
Q_PLUGIN_METADATA(IID "org.nemomobile.contacts")
#endif

public:
virtual ~NemoContactsPlugin() { }

void initializeEngine(QDeclarativeEngine *, const char *uri)
void initializeEngine(QQmlEngine *, const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.nemomobile.contacts"));
}
Expand All @@ -71,8 +62,4 @@ class Q_DECL_EXPORT NemoContactsPlugin : public QDeclarativeExtensionPlugin
}
};

#ifndef QT_VERSION_5
Q_EXPORT_PLUGIN2(nemocontacts, NemoContactsPlugin);
#endif

#include "plugin.moc"
10 changes: 0 additions & 10 deletions src/seasidefilteredmodel.cpp
Expand Up @@ -290,11 +290,7 @@ struct FilterData : public SeasideCache::ItemListener
insert(matchTokens, splitWords(name.suffix()));

// Include the custom label - it may contain the user's customized name for the contact
#ifdef USING_QTPIM
insert(matchTokens, splitWords(name.value<QString>(QContactName__FieldCustomLabel)));
#else
insert(matchTokens, splitWords(name.customLabel()));
#endif

QContactNickname nickname = item->contact.detail<QContactNickname>();
insert(matchTokens, splitWords(nickname.nickname()));
Expand Down Expand Up @@ -390,10 +386,6 @@ SeasideFilteredModel::SeasideFilteredModel(QObject *parent)
, m_searchByFirstNameCharacter(false)
, m_lastItem(0)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
setRoleNames(roleNames());
#endif

updateRegistration();

m_allContactIds = SeasideCache::contacts(SeasideCache::FilterAll);
Expand Down Expand Up @@ -1013,12 +1005,10 @@ void SeasideFilteredModel::updateFilters(const QString &pattern, int property)
if (m_filterPattern != pattern) {
m_filterPattern = pattern;
m_filterParts = extractSearchTerms(m_filterPattern);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// Qt5 does not recognize '#' as a word
if (m_filterParts.isEmpty() && !pattern.isEmpty()) {
m_filterParts.append(QStringList() << pattern);
}
#endif
changedPattern = true;
}
if (m_requiredProperty != property) {
Expand Down
9 changes: 2 additions & 7 deletions src/seasidefilteredmodel.h
Expand Up @@ -40,7 +40,7 @@

class SeasidePerson;

USE_CONTACTS_NAMESPACE
QTCONTACTS_USE_NAMESPACE

class SeasideFilteredModel : public SeasideCache::ListModel
{
Expand Down Expand Up @@ -108,8 +108,6 @@ class SeasideFilteredModel : public SeasideCache::ListModel
AccountDetailsRole
};

typedef SeasideCache::ContactIdType ContactIdType;

SeasideFilteredModel(QObject *parent = 0);
~SeasideFilteredModel();

Expand Down Expand Up @@ -169,10 +167,7 @@ class SeasideFilteredModel : public SeasideCache::ListModel
void insertRange(int index, int count, const QList<quint32> &source, int sourceIndex);
void removeRange(int index, int count);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
virtual
#endif
QHash<int, QByteArray> roleNames() const;
virtual QHash<int, QByteArray> roleNames() const;

// Implementations for SeasideCache::ListModel:
void sourceAboutToRemoveItems(int begin, int end);
Expand Down
4 changes: 0 additions & 4 deletions src/seasidenamegroupmodel.cpp
Expand Up @@ -45,10 +45,6 @@ SeasideNameGroupModel::SeasideNameGroupModel(QObject *parent)
{
SeasideCache::registerNameGroupChangeListener(this);

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
setRoleNames(roleNames());
#endif

const QStringList &allGroups = SeasideCache::allNameGroups();
QHash<QString, QSet<quint32> > existingGroups = SeasideCache::nameGroupMembers();
if (!existingGroups.isEmpty()) {
Expand Down
7 changes: 2 additions & 5 deletions src/seasidenamegroupmodel.h
Expand Up @@ -40,7 +40,7 @@

#include <QContactId>

USE_CONTACTS_NAMESPACE
QTCONTACTS_USE_NAMESPACE

class SeasideNameGroup
{
Expand Down Expand Up @@ -91,10 +91,7 @@ class SeasideNameGroupModel : public QAbstractListModel, public SeasideNameGroup

void nameGroupsUpdated(const QHash<QString, QSet<quint32> > &groups);

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
virtual
#endif
QHash<int, QByteArray> roleNames() const;
virtual QHash<int, QByteArray> roleNames() const;

signals:
void countChanged();
Expand Down

0 comments on commit f5be813

Please sign in to comment.