[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().
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.
[qtcontacts-sqlite] Use transient ID tables to avoid bound variables limit

If a query includes a large group of contact IDs, create a transient
table to reference those IDs from, in order to avoid the SQLite limit
on the total number of bound variables per query.

Conflicts:
	src/engine/contactreader.cpp
	src/engine/contactsdatabase.cpp
Merge pull request #99 from matthewvogt/query-improvements

Query improvements
[qtcontacts-sqlite] Join detail tables so we make a single query to read details

Rather than reading all detail tables in parallel queries, join them
all into a single query of the Details table.
[qtcontacts-sqlite] Cache prepared detail queries