[qtcontacts-sqlite] Close database on destruction.

Ensure that we close the databases to avoid leaking fds.
Merge pull request #92 from chriadam/fixfd

[qtcontacts-sqlite] Close database on destruction.
[qtcontacts-sqlite] Fix: Check for read/write capability using QFileInfo

This fixes e4f626a (Check for read/write capability using QFileInfo).

Met the bug while executing commhistory-daemon tests.

QFileInfo::permission(QFile::ReadGroup | QFile::WriteGroup) only checks
file permission bits. It does not honor process' GID. As a result it
always claims the 'privileged' directory is RW to the user, as it is
installed with 0070 mode set.

Note that there is also difference between corresponding QFile::*User
and QFile::*Owner R/W/X flags and it seems Qt API documentation is not
accurate about this - the note about platform difference between Windows
and Unix seems to not be true anymore (not sure though).

Comment replaced because QDir::isReadable() actually supports group
permissions, but there is no QDir::isWritable().
[qtcontacts-sqlite] Correct the derivation of global presence

Global presence should be updated when non-global presence details are
not excluded by the definition mask.  Also, unknown presence state
is never a better presence than any other defined value.
Merge pull request #93 from matthewvogt/global-presence

[qtcontacts-sqlite] Correct the derivation of global presence
[qtcontacts-sqlite] Use definition mask for aggregate update

When updating aggregates of a modified contact, apply the same
definition mask used in updating the constituent.
[qtcontacts-sqlite] Report presence changes independently

If requested via contact manager parameters, the contact manager will
report changes to contact presence details via a separate signal to
that used to report other changes.  If not requested, the usual signal
will be emitted.

A presence change is one where the only affected details (according to
the update's definition mask) are in the set { Presence, OnlineAccount,
OriginMetadata }.
[qtcontacts-sqlite] Suppress presence change notification by default

The qtcontacts-sqlite engine will now suppress the emission of the
contactsChanged signal for presence changes, unless configured to do
otherwise.  Presence changes are still reported via the internal
contactsPresenceChanged signal, which should be preferred if presence
change processing is desired.

If the 'mergePresenceChanges' parameter is set to 'true', then presence
changes will be reported via the contactsChanged signal rather than
the contactsPresenceChanged signal, which yields behavior consistent
with the Qt4 QtContacts API.  If the parameter is not supplied to the
engine, a warning is emitted to describe the effect.

The 'separatePresenceChanges' parameter is removed.
[qtcontacts-sqlite] Sort presence states by availability

The values of presence states defined by QtContacts order Busy as
more present than Away.  However, a contact who has signalled that
they are busy is likely to be less available for communication than
one who has Away status. Add (and enable) an option to reverse the
ordering of these two states.
Merge pull request #97 from matthewvogt/presence-order

[qtcontacts-sqlite] Sort presence states by availability
Merge pull request #95 from matthewvogt/presence-updates

[qtcontacts-sqlite] Report presence changes independently
Update exported version number
[qtcontacts-sqlite] Disable automatic partial match when firstName is hyphenated

When we have a contact with a hyphenated first name, do not merge with
contacts whose first name is only a partial match. In French, for
example, the names 'Jean Bretodeau' and 'Pierre Bretodeau' would be
unlikely to represent the same person as 'Jean-Pierre Bretodeau'.
Merge pull request #98 from matthewvogt/no-partial-match-with-hyphen

[qtcontacts-sqlite] Disable automatic partial match when firstName is hyphenated
Merge pull request #90 from martyone/master

[qtcontacts-sqlite] Fix: Check for read/write capability using QFileInfo
[qtcontacts-sqlite] Expand query fetch timing variations

Include timings for different methods of querying contacts.
[qtcontacts-sqlite] Do not filter out non-aggregates with ID filter

When an ID filter is used, we must return any contacts selected by
that filter; do not apply the automatic suppression of non-aggregates.
[qtcontacts-sqlite] Prefer to compare internal IDs

It is faster to compare IDs in internal form than in QContactId form.
This remains true if the IDs must be converted to that form purely
for comparison purposes.
[qtcontacts-sqlite] Do not use order by clause when unnecessary

If a specific sort is not required, avoid the overhead of order by.
[qtcontacts-sqlite] Insert rows into temp tables without execBatch

QSqlQuery::execBatch() is not optimized when using SQLite, it is faster
to manually formulate insert statements with embedded data items.