Skip to content

Commit

Permalink
Merge branch 'jb47084' into 'master'
Browse files Browse the repository at this point in the history
[qtcontacts-sqlite] Add a fallback to company name when synthesizing a display label. Fixes JB#47084

See merge request mer-core/qtcontacts-sqlite!37
  • Loading branch information
adenexter committed Nov 14, 2019
2 parents 7fd4ead + 9806c86 commit 8d56179
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/engine/contactsdatabase.cpp
Expand Up @@ -1308,6 +1308,10 @@ static const char *upgradeVersion18[] = {
"PRAGMA user_version=19",
0 // NULL-terminated
};
static const char *upgradeVersion19[] = {
"PRAGMA user_version=20",
0 // NULL-terminated
};

typedef bool (*UpgradeFunction)(QSqlDatabase &database);

Expand Down Expand Up @@ -1826,9 +1830,10 @@ static UpgradeOperation upgradeVersions[] = {
{ updateStorageTypes, upgradeVersion16 },
{ addDisplayLabelGroup, upgradeVersion17 },
{ forceRegenDisplayLabelGroups, upgradeVersion18 },
{ forceRegenDisplayLabelGroups, upgradeVersion19 },
};

static const int currentSchemaVersion = 19;
static const int currentSchemaVersion = 20;

static bool execute(QSqlDatabase &database, const QString &statement)
{
Expand Down
6 changes: 6 additions & 0 deletions src/engine/contactsengine.cpp
Expand Up @@ -1442,6 +1442,12 @@ QString ContactsEngine::synthesizedDisplayLabel(const QContact &contact, QContac
}
}

foreach (const QContactOrganization& organization, contact.details<QContactOrganization>()) {
if (!organization.name().isEmpty()) {
return organization.name();
}
}

foreach (const QContactOnlineAccount& account, contact.details<QContactOnlineAccount>()) {
if (!account.accountUri().isEmpty()) {
return account.accountUri();
Expand Down

0 comments on commit 8d56179

Please sign in to comment.