Commit 24613850 authored by neochapay's avatar neochapay

[packaging] Drop old api

parent 9bf3a397
%define qtpim_verion %(rpm -q --qf "%{VERS""ION}\n" qt5-qtpim-contacts | tr --delete . | cut -f1 -d"+" | cut -c1-3)
Name: qtcontacts-sqlite-qt5
Version: 0.2.36
Release: 0
......@@ -11,7 +9,7 @@ Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Sql)
BuildRequires: pkgconfig(Qt5DBus)
BuildRequires: pkgconfig(Qt5Contacts)
BuildRequires: qt5-qtpim-contacts-devel >= 5.9.0
BuildRequires: pkgconfig(mlite5)
Requires: qt5-plugin-sqldriver-sqlite
......@@ -22,20 +20,6 @@ Requires: qt5-plugin-sqldriver-sqlite
%defattr(-,root,root,-)
%{_libdir}/qt5/plugins/contacts/*.so*
#%package tests
#Summary: Unit tests for qtcontacts-sqlite-qt5
#Group: System/Libraries
#BuildRequires: pkgconfig(Qt5Test)
#Requires: %{name} = %{version}-%{release}
#%description tests
#This package contains unit tests for the qtcontacts-sqlite-qt5 library.
#%files tests
#%defattr(-,root,root,-)
#/opt/tests/qtcontacts-sqlite-qt5/*
#%{_libdir}/qtcontacts-sqlite-qt5/libtestdlgg.so
%package extensions
Summary: QtContacts extension headers for qtcontacts-sqlite-qt5
Group: Development/Libraries
......@@ -54,7 +38,7 @@ This package contains extension headers for the qtcontacts-sqlite-qt5 library.
%setup -q -n %{name}-%{version}
%build
%qmake5 "VERSION=%{version}" QTPIM_VERSION=%{qtpim_verion}
%qmake5 "VERSION=%{version}"
make %{?_smp_mflags}
%install
......
......@@ -72,13 +72,8 @@ QContactId ContactId::apiId(const QContact &contact)
QContactId ContactId::apiId(quint32 dbId)
{
#if QTPIM_VERSION < 59
ContactId *eid = new ContactId(dbId);
return QContactId(eid);
#else
return QContactId(QContactManager::buildUri(default_uri, QMap<QString, QString>()),
dbIdToLocalId(dbId));
#endif
}
......@@ -89,15 +84,7 @@ quint32 ContactId::databaseId(const QContact &contact)
quint32 ContactId::databaseId(const QContactId &apiId)
{
#if QTPIM_VERSION < 59
if (const QContactEngineId *eid = QContactManagerEngine::engineId(apiId)) {
const ContactId *iid = static_cast<const ContactId*>(eid);
return iid->m_databaseId;
}
return 0;
#else
return dbIdFromLocalId(apiId.localId());
#endif
}
......@@ -108,46 +95,8 @@ const QContactId &ContactId::contactId(const QContactId &apiId)
QContactId ContactId::fromString(const QString &s)
{
#if QTPIM_VERSION < 59
return apiId(dbIdFromString(s));
#else
return apiId(dbIdFromLocalId(s.toUtf8()));
#endif
}
#if QTPIM_VERSION < 59
ContactId::ContactId(quint32 dbId)
: QContactEngineId()
, m_databaseId(dbId)
{
}
ContactId::ContactId(const QString &s)
: QContactEngineId()
, m_databaseId(dbIdFromString(s))
{
}
bool ContactId::isEqualTo(const QContactEngineId *other) const
{
return m_databaseId == static_cast<const ContactId*>(other)->m_databaseId;
}
bool ContactId::isLessThan(const QContactEngineId *other) const
{
return m_databaseId < static_cast<const ContactId*>(other)->m_databaseId;
}
QString ContactId::managerUri() const
{
return QContactManager::buildUri(default_uri, QMap<QString, QString>());
}
QContactEngineId* ContactId::clone() const
{
return new ContactId(m_databaseId);
}
#endif
QString ContactId::toString() const
{
......
......@@ -36,19 +36,11 @@
#include <QContactId>
#include <QContact>
#if QTPIM_VERSION < 59
#include <QContactEngineId>
#else
#include <QSharedDataPointer>
#endif
QTCONTACTS_USE_NAMESPACE
#if QTPIM_VERSION < 59
class ContactId : public QContactEngineId
#else
class ContactId : public QSharedData
#endif
{
public:
static QContactId apiId(const QContact &contact);
......@@ -72,12 +64,6 @@ public:
ContactId(const QString &s);
QString managerUri() const;
#if QTPIM_VERSION < 59
// implementing QContactEngineId:
bool isEqualTo(const QContactEngineId *other) const;
bool isLessThan(const QContactEngineId *other) const;
QContactEngineId* clone() const;
#endif
QString toString() const;
#ifndef QT_NO_DEBUG_STREAM
......
......@@ -658,15 +658,9 @@ static QContactRelationship makeRelationship(const QString &type, quint32 firstI
{
QContactRelationship relationship;
relationship.setRelationshipType(type);
#if QTPIM_VERSION < 59
QContact first, second;
first.setId(ContactId::apiId(firstId));
second.setId(ContactId::apiId(secondId));
#else
QContactId first, second;
first = QContactId::fromString(QString::number(firstId));
second = QContactId::fromString(QString::number(secondId));
#endif
relationship.setFirst(first);
relationship.setSecond(second);
......@@ -1232,11 +1226,7 @@ static QString buildWhere(const QContactIdFilter &filter, ContactsDatabase &db,
static QString buildWhere(const QContactRelationshipFilter &filter, QVariantList *bindings, bool *failed)
{
#if QTPIM_VERSION < 59
QContactId rci = filter.relatedContact().id();
#else
QContactId rci = filter.relatedContactId();
#endif
QContactRelationship::Role rcr = filter.relatedContactRole();
QString rt = filter.relationshipType();
......@@ -2184,9 +2174,6 @@ QContactManager::Error ContactReader::queryContacts(
QContactGender gender;
// Gender is an enum in qtpim
QString genderText = contactQuery.value(col++).toString();
#if QTPIM_VERSION < 59
gender.setGender(static_cast<QContactGender::GenderField>(genderText.toInt()));
#else
if(genderText == "Male") {
gender.setGender(QContactGender::GenderType::GenderMale);
} else if (genderText == "Female") {
......@@ -2194,7 +2181,6 @@ QContactManager::Error ContactReader::queryContacts(
} else {
gender.setGender(QContactGender::GenderType::GenderUnspecified);
}
#endif
contact.saveDetail(&gender);
QContactFavorite favorite;
......
......@@ -466,13 +466,8 @@ public:
RelationshipFetchJob(QContactRelationshipFetchRequest *request)
: TemplateJob(request)
, m_type(request->relationshipType())
#if QTPIM_VERSION < 59
, m_first(request->first().id())
, m_second(request->second().id())
#else
, m_first(request->first().managerUri(), request->first().localId())
, m_second(request->second().managerUri(), request->second().localId())
#endif
{
}
......@@ -1409,21 +1404,13 @@ void ContactsEngine::_q_contactsAdded(const QVector<quint32> &contactIds)
void ContactsEngine::_q_contactsChanged(const QVector<quint32> &contactIds)
{
#if QTPIM_VERSION < 59
emit contactsChanged(idList(contactIds));
#else
emit contactsChanged(idList(contactIds), detalId());
#endif
}
void ContactsEngine::_q_contactsPresenceChanged(const QVector<quint32> &contactIds)
{
if (m_mergePresenceChanges) {
#if QTPIM_VERSION < 59
emit contactsChanged(idList(contactIds));
#else
emit contactsChanged(idList(contactIds), detalId());
#endif
} else {
emit contactsPresenceChanged(idList(contactIds));
}
......
......@@ -118,11 +118,7 @@ public:
const QString &relationshipType,
const QContact &participant,
QContactRelationship::Role role,
QContactManager::Error *error) const
#if QTPIM_VERSION < 59
override
#endif
;
QContactManager::Error *error) const;
bool saveRelationships(
QList<QContactRelationship> *relationships,
......
......@@ -48,10 +48,6 @@ public:
QContactManagerEngine *engine(
const QMap<QString, QString> &parameters, QContactManager::Error* error);
QString managerName() const;
#if QTPIM_VERSION < 59
QContactEngineId *createContactEngineId(
const QMap<QString, QString> &parameters, const QString &engineIdString) const;
#endif
};
......@@ -79,13 +75,4 @@ QString ContactsFactory::managerName() const
return QString::fromLatin1("org.nemomobile.contacts.sqlite");
}
#if QTPIM_VERSION < 59
QContactEngineId *ContactsFactory::createContactEngineId(
const QMap<QString, QString> &parameters, const QString &engineIdString) const
{
Q_UNUSED(parameters)
return new ContactId(engineIdString);
}
#endif
#include "contactsplugin.moc"
......@@ -413,13 +413,9 @@ QContactManager::Error ContactWriter::saveRelationships(
for (int i = 0; i < relationships.size(); ++i) {
const QContactRelationship &relationship = relationships.at(i);
#if QTPIM_VERSION < 59
QContactId first(relationship.first().id());
QContactId second(relationship.second().id());
#else
QContactId first = relationship.first();
QContactId second = relationship.second();
#endif
const quint32 firstId = ContactId::databaseId(first);
const quint32 secondId = ContactId::databaseId(second);
const QString &type = relationship.relationshipType();
......@@ -2697,11 +2693,7 @@ static void promoteDetailsToLocal(const QList<QContactDetail> addDelta, const QL
localContact->saveDetail(&lts);
} else if (type == detailType<QContactGender>()) {
QContactGender lg = localContact->detail<QContactGender>();
#if QTPIM_VERSION < 59
lg.setGender(static_cast<QContactGender::GenderField>(original.value<int>(QContactGender::FieldGender)));
#else
lg.setGender(lg.gender());
#endif
localContact->saveDetail(&lg);
} else if (type == detailType<QContactFavorite>()) {
QContactFavorite lf = localContact->detail<QContactFavorite>();
......@@ -2743,16 +2735,8 @@ static QContactRelationship makeRelationship(const QString &type, const QContact
QContactRelationship relationship;
relationship.setRelationshipType(type);
#if QTPIM_VERSION < 59
QContact first, second;
first.setId(firstId);
second.setId(secondId);
relationship.setFirst(first);
relationship.setSecond(second);
#else
relationship.setFirst(firstId);
relationship.setSecond(secondId);
#endif
return relationship;
}
......
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