This repository has been archived by the owner on Sep 4, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract SeasideCache from nemo-qml-plugin-contacts and export from this library.
- Loading branch information
0 parents
commit e702826
Showing
18 changed files
with
3,072 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include(package.pri) | ||
include(contacts-namespace.pri) | ||
|
||
CONFIG += qt link_pkgconfig | ||
QT -= gui | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# We need different macros depending on which Contacts we're using | ||
equals(QT_MAJOR_VERSION, 4) { | ||
DEFINES *= BEGIN_CONTACTS_NAMESPACE=QTM_BEGIN_NAMESPACE | ||
DEFINES *= END_CONTACTS_NAMESPACE=QTM_END_NAMESPACE | ||
DEFINES *= USE_CONTACTS_NAMESPACE=QTM_USE_NAMESPACE | ||
DEFINES *= BEGIN_VERSIT_NAMESPACE= | ||
DEFINES *= END_VERSIT_NAMESPACE= | ||
DEFINES *= USE_VERSIT_NAMESPACE= | ||
} | ||
equals(QT_MAJOR_VERSION, 5) { | ||
DEFINES *= USING_QTPIM | ||
DEFINES *= BEGIN_CONTACTS_NAMESPACE=QT_BEGIN_NAMESPACE_CONTACTS | ||
DEFINES *= END_CONTACTS_NAMESPACE=QT_END_NAMESPACE_CONTACTS | ||
DEFINES *= USE_CONTACTS_NAMESPACE=QTCONTACTS_USE_NAMESPACE | ||
DEFINES *= BEGIN_VERSIT_NAMESPACE=QT_BEGIN_NAMESPACE_VERSIT | ||
DEFINES *= END_VERSIT_NAMESPACE=QT_END_NAMESPACE_VERSIT | ||
DEFINES *= USE_VERSIT_NAMESPACE=QTVERSIT_USE_NAMESPACE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TEMPLATE = subdirs | ||
SUBDIRS = src tests | ||
|
||
tests.depends = src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
equals(QT_MAJOR_VERSION, 4): PACKAGENAME=contactcache | ||
equals(QT_MAJOR_VERSION, 5): PACKAGENAME=contactcache-qt5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
Name: libcontacts-qt5 | ||
Summary: Nemo contact cache library | ||
Version: 0.0.0 | ||
Release: 1 | ||
Group: System/Libraries | ||
License: BSD | ||
URL: https://github.com/nemomobile/libcontacts | ||
Source0: %{name}-%{version}.tar.bz2 | ||
Requires: qtcontacts-sqlite-qt5 | ||
BuildRequires: pkgconfig(Qt5Core) | ||
BuildRequires: pkgconfig(Qt5Test) | ||
BuildRequires: pkgconfig(Qt5Contacts) | ||
BuildRequires: pkgconfig(Qt5Versit) | ||
BuildRequires: pkgconfig(mlite5) | ||
BuildRequires: pkgconfig(qtcontacts-sqlite-qt5-extensions) | ||
|
||
%description | ||
%{summary}. | ||
|
||
%package tests | ||
Summary: Nemo contact cache library tests | ||
Group: System/Libraries | ||
Requires: %{name} = %{version}-%{release} | ||
|
||
%description tests | ||
%{summary}. | ||
|
||
%package devel | ||
Summary: Nemo contact cache library headers | ||
Group: System/Libraries | ||
Requires: %{name} = %{version}-%{release} | ||
|
||
%description devel | ||
%{summary}. | ||
|
||
%prep | ||
%setup -q -n %{name}-%{version} | ||
|
||
%build | ||
|
||
%qmake5 | ||
|
||
make %{?jobs:-j%jobs} | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
%qmake_install | ||
|
||
%post -p /sbin/ldconfig | ||
|
||
%postun -p /sbin/ldconfig | ||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%{_libdir}/libcontactcache-qt5.so* | ||
|
||
%files tests | ||
%defattr(-,root,root,-) | ||
/opt/tests/contactcache-qt5/* | ||
|
||
%files devel | ||
%defattr(-,root,root,-) | ||
%{_includedir}/contactcache-qt5/* | ||
%{_libdir}/pkgconfig/contactcache-qt5.pc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Name: libcontacts | ||
Summary: Nemo contact cache library | ||
Version: 0.0.0 | ||
Release: 1 | ||
Group: System/Libraries | ||
License: BSD | ||
URL: https://github.com/nemomobile/libcontacts | ||
Source0: %{name}-%{version}.tar.bz2 | ||
Requires: qtcontacts-sqlite | ||
BuildRequires: pkgconfig(QtCore) | ||
BuildRequires: pkgconfig(QtContacts) | ||
BuildRequires: pkgconfig(QtVersit) | ||
BuildRequires: pkgconfig(mlite) | ||
BuildRequires: pkgconfig(qtcontacts-sqlite-extensions) | ||
|
||
%description | ||
%{summary}. | ||
|
||
%package tests | ||
Summary: Nemo contact cache library tests | ||
Group: System/Libraries | ||
Requires: %{name} = %{version}-%{release} | ||
|
||
%description tests | ||
%{summary}. | ||
|
||
%package devel | ||
Summary: Nemo contact cache library headers | ||
Group: System/Libraries | ||
Requires: %{name} = %{version}-%{release} | ||
|
||
%description devel | ||
%{summary}. | ||
|
||
%prep | ||
%setup -q -n %{name}-%{version} | ||
|
||
%build | ||
|
||
%qmake | ||
|
||
make %{?jobs:-j%jobs} | ||
|
||
%install | ||
rm -rf %{buildroot} | ||
%qmake_install | ||
|
||
%post -p /sbin/ldconfig | ||
|
||
%postun -p /sbin/ldconfig | ||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%{_libdir}/libcontactcache.so* | ||
|
||
%files tests | ||
%defattr(-,root,root,-) | ||
/opt/tests/contactcache/* | ||
|
||
%files devel | ||
%defattr(-,root,root,-) | ||
%{_includedir}/contactcache/* | ||
%{_libdir}/pkgconfig/contactcache.pc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (C) 2013 Jolla Mobile <matthew.vogt@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 CONTACTCACHEEXPORT_H | ||
#define CONTACTCACHEEXPORT_H | ||
|
||
#include <QtGlobal> | ||
|
||
#ifdef CONTACTCACHE_BUILD | ||
#define CONTACTCACHE_EXPORT Q_DECL_EXPORT | ||
#else | ||
#define CONTACTCACHE_EXPORT Q_DECL_IMPORT | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* libseaside - Library that provides an interface to the Contacts application | ||
* Copyright (c) 2013, Matt Vogt | ||
* | ||
* This program is licensed under the terms and conditions of the | ||
* Apache License, version 2.0. The full text of the Apache License is at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
*/ | ||
|
||
#include "normalization_p.h" | ||
|
||
namespace Normalization { | ||
|
||
QString normalizePhoneNumber(const QString &input) | ||
{ | ||
// Use the same algorithm as maemo localNumber | ||
|
||
// Not actually the 'visual-separators' from RFC3966... | ||
// This logic is derived from qtcontacts-tracker | ||
static const QString separators(QString::fromLatin1(" .-()[]")); | ||
static const QString dtmfChars(QString::fromLatin1("pPwWxX")); | ||
|
||
// TODO: possibly make this tunable? | ||
static const int maxCharacters = 7; | ||
|
||
QString subset; | ||
subset.reserve(input.length()); | ||
|
||
QString::const_iterator it = input.constBegin(), end = input.constEnd(); | ||
for ( ; it != end; ++it) { | ||
if ((*it).isDigit()) { | ||
// Convert to ASCII, capturing unicode digit values | ||
subset.append(QChar::fromLatin1('0' + (*it).digitValue())); | ||
} else if (!separators.contains(*it) && | ||
(*it).category() != QChar::Other_Format) { | ||
// If this is a DTMF character, stop processing here | ||
if (dtmfChars.contains(*it)) { | ||
break; | ||
} else { | ||
subset.append(*it); | ||
} | ||
} | ||
} | ||
|
||
return subset.right(maxCharacters); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* libseaside - Library that provides an interface to the Contacts application | ||
* Copyright (c) 2013, Matt Vogt | ||
* | ||
* This program is licensed under the terms and conditions of the | ||
* Apache License, version 2.0. The full text of the Apache License is at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
*/ | ||
|
||
#ifndef __NORMALIZATION_P_H__ | ||
#define __NORMALIZATION_P_H__ | ||
|
||
#include <QString> | ||
|
||
namespace Normalization { | ||
|
||
QString normalizePhoneNumber(const QString &input); | ||
|
||
} | ||
|
||
#endif |
Oops, something went wrong.