Commit c6f0e5d5 authored by chriadam's avatar chriadam

Merge branch 'mer1664' into 'master'

[libcontacts] Load decomposition translations. Contributes to MER#1664

Previously, we relied on the client application to load the translation
files prior to performing FN to N decomposition tokenisation.
This commit ensures that the translations are loaded by libcontacts.

Contributes to MER#1664

See merge request !4
parents 342d98c4 ca662019
......@@ -509,6 +509,8 @@ int bestPhoneNumberMatchLength(const QContact &contact, const QString &match)
SeasideCache *SeasideCache::instancePtr = 0;
int SeasideCache::contactNameGroupCount = getContactNameGroupCount();
QStringList SeasideCache::allContactNameGroups = getAllContactNameGroups();
QTranslator *SeasideCache::engEnTranslator = 0;
QTranslator *SeasideCache::translator = 0;
QContactManager* SeasideCache::manager()
......@@ -1215,6 +1217,15 @@ void updateNameDetail(F1 getter, F2 setter, QContactName *nameDetail, const QStr
void SeasideCache::decomposeDisplayLabel(const QString &formattedDisplayLabel, QContactName *nameDetail)
if (!translator) {
engEnTranslator = new QTranslator(qApp);
engEnTranslator->load(QString::fromLatin1("libcontacts_eng_en"), QString::fromLatin1("/usr/share/translations"));
translator = new QTranslator(qApp);
translator->load(QLocale(), QString::fromLatin1("libcontacts"), QString::fromLatin1("-"), QString::fromLatin1("/usr/share/translations"));
// Try to parse the structure from the formatted name
// TODO: Use MBreakIterator for localized splitting
QStringList tokens(formattedDisplayLabel.split(QChar::fromLatin1(' '), QString::SkipEmptyParts));
......@@ -52,6 +52,7 @@
#include <QContactIdFetchRequest>
#include <QContactName>
#include <QTranslator>
#include <QBasicTimer>
#include <QHash>
#include <QSet>
......@@ -491,6 +492,8 @@ private:
static SeasideCache *instancePtr;
static int contactNameGroupCount;
static QStringList allContactNameGroups;
static QTranslator *engEnTranslator;
static QTranslator *translator;
friend bool operator==(const SeasideCache::ResolveData &lhs, const SeasideCache::ResolveData &rhs);
friend uint qHash(const SeasideCache::ResolveData &key, uint seed);
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