Merge pull request #55 from martyone/master

[libcommhistory] Fix DatabaseIO::getEventBy*()
[libcommhistory] Don't use minimized phone numbers for comparison

We cannot reliably compare minimized phone numbers at this level; the
algorithm can and does fail, and when we're doing it here, there is no
possibility of recovering from that. Use normalized numbers instead, and
rely on contact grouping to combine groups for the same contact or
minimized number in the UI.
[libcommhistory] Combine unresolved groups by short number match

Groups are matched only on full, exact phone numbers, so that phone
number matching can be done more accurately by the contacts layer (which
can correctly handle conflicts). For unresolved phone numbers, we must
combine groups by the short number match so that differently formatted
numbers are still combined for the user despite being separate.
Merge pull request #56 from special/no-minimized-addresses

Avoid using minimized numbers for address matching
[libcommhistory] Compare numbers in minimized form for contact match

Although we can't be certain that a minimized match is the best match
for a specific number, it is very likely to be the case, since the
first matching contact we receive is allmost certainly the result of
querying for the match.
[libcommhistory] Sort UIDs in normalized form where possible

Without normalization, sorting will be adversely affected by extraneous
punctuation.
Merge pull request #57 from matthewvogt/recent-contacts-fix

[libcommhistory] Compare numbers in minimized form for contact match
tests: Skip test cases for message parts

Message parts are not yet supported with SQLite.

See 91ab2f8 (Implement early basic sqlite database code) and
c484c81 (Remove tracker database and sparql query code).
tests: Skip test cases for contact matching

Contact matching is not yet supported with SQLite.

See c484c81 (Remove tracker database and sparql query code).
tests: Skip test cases for query limit

Query limit is not yet supported with SQLite.

See 91ab2f8 (Implement early basic sqlite database code).
ut_eventmodel: Fix clean-up

Cleaaingn-up events is broken since commit e7bde7e (Add
RecentContactsModel) which introduced addedEventIds to only cleanup
events added via addTestEvent interface. Only minority of test events in
ut_eventmodel is created via this interface. Most of them are actually
cleaned up because they are assigned a groupId (compare
cleanupTestGroups() with cleanupTestEvents from common.cpp).  'call'
event is not set a groupId and so it is not cleaned-up upon exit.
Deleting 'call' event "manually" in EventModelTest::cleanupTestCase() as
a QUICK FIX!
ut_callmodel: Use 'sips' URI scheme inst. of 'sip'

This is necessary since 18d6d14 (Use generic phone number functions) as
QtContactsSqliteExtensions::normalizePhoneNumber() only recognizes the
"secure" SIP URIs and (as confirmed by qtcontacts-sqlite developer) this
is not likely to change.
ut_callmodel: Fix testDeleteEvent

Broken since 4d16bd8 (Fix CallModel eventDeleted signal with groups).
The first occurence might be a typo from 5f16ec7 (Fix unit tests for
sqlite backend) as well.
ut_callmodel: Fix testModifyEvent

Broken since e15d6c4 (Fix CallModel insertion in grouped mode).
tests: Fix cleanupTestEvents()

Note that this bug has had no impact on test results.
[libcommhistory] Properly disable StreamedAsyncQuery related code

This fixes the way how StreamedAsyncQuery related code was disabled with
91ab2f8 (Implement early basic sqlite database code). See e.g.
ConversationModelPrivate::isModelReady() and track how activeQueries and
eventsFilled are (not) updated after 91ab2f8.
[libcommhistory] Assign in-model-only events valid IDs

Before migration to SQLite, events stored in-model-only used to be
assigned an artificial ID. This changed with 91ab2f8 (Implement early
basic sqlite database code) so that such events are set an invalid ID =
-1 (search for use of tracker()->nextEventId() in 91ab2f8 diff). This
broke this in-model-only events handling and it was first noticed in
case of ClassZeroSMSEvent. An attempt to fix this with e3a1901 (Fix
exporting and behavior of ClassZeroSMSModel) helped to discover the
actual issue as it actually inverted its effect instead of fixing it:
every event added in-model-only is inserted twice because
findEventRecursive() modified with e3a1901 never success finding event
with an invalid id and so it gets reinserted when self-emitted
eventsAdded() D-Bus signal is received (detected by
ConversationModelTest::getEvent()).

This commit reintroduces assigning the in-model-only events artificial
ids.