Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[qtcontacts-sqlite] Add 'created' and 'modified' columns to Details t…
…able. JB#52969
- Loading branch information
Showing
4 changed files
with
41 additions
and
6 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 |
---|---|---|
|
@@ -689,6 +689,8 @@ static void readDetail(QContact *contact, QSqlQuery &query, quint32 contactId, q | |
const QVariant modifiableVariant = query.value(col++); | ||
const bool nonexportable = query.value(col++).toBool(); | ||
const int changeFlags = query.value(col++).toInt(); | ||
const QDateTime created = query.value(col++).toDateTime(); | ||
const QDateTime modified = query.value(col++).toDateTime(); | ||
|
||
// only save the detail to the contact if it hasn't been deleted, | ||
// or if we are part of a sync fetch (i.e. keepChangeFlags is true) | ||
|
@@ -739,6 +741,9 @@ static void readDetail(QContact *contact, QSqlQuery &query, quint32 contactId, q | |
setValue(&detail, QContactDetail__FieldChangeFlags, changeFlags); | ||
} | ||
|
||
setValue(&detail, QContactDetail__FieldCreated, created); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pvuorela
Contributor
|
||
setValue(&detail, QContactDetail__FieldModified, modified); | ||
|
||
// Constraints should be applied unless generating a partial aggregate; the partial aggregate | ||
// is intended for modification, so adding constraints prevents it from being used correctly. | ||
// Normal aggregate contact details are always immutable. | ||
|
@@ -2524,6 +2529,8 @@ QContactManager::Error ContactReader::queryContacts( | |
"Details.modifiable," | ||
"COALESCE(Details.nonexportable, 0)," | ||
"Details.changeFlags, " | ||
"Details.created, " | ||
"Details.modified, " | ||
"%1 " | ||
"FROM temp.%2 " | ||
"CROSS JOIN Details ON Details.contactId = temp.%2.contactId " // Cross join ensures we scan the temp table first | ||
|
@@ -2545,7 +2552,7 @@ QContactManager::Error ContactReader::queryContacts( | |
QHash<QString, QPair<ReadDetail, int> > readProperties; | ||
|
||
// Skip the Details table fields, and the indexing fields of the first join table | ||
int offset = 11 + 2; | ||
int offset = 13 + 2; | ||
|
||
const ContactWriter::DetailList &definitionMask = fetchHint.detailTypesHint(); | ||
|
||
|
@@ -2633,6 +2640,10 @@ QContactManager::Error ContactReader::queryContacts( | |
contact.saveDetail(&deactivated); | ||
} | ||
|
||
// ignore created and modified timestamps, will be saved by readDetail() | ||
col++; | ||
col++; | ||
|
||
int contactType = contactQuery.value(col++).toInt(); | ||
QContactType typeDetail = contact.detail<QContactType>(); | ||
typeDetail.setType(static_cast<QContactType::TypeValues>(contactType)); | ||
|
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
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
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
Hi! This commit breaks the unit tests:
(I added two debug lines to print the actual values
name
andupdatedName
)I'm not sure about the correct solution: one option would be to remove these two details before doing the comparison, but maybe we should change the
==
operator of QContactDetail to ignore these two fields? They are metadata, they probably should not be used in the comparison.Also, please, add a bug tracker to this project :-)