Commit Graph

21540 Commits

Author SHA1 Message Date
Gatis Paeglis
d40b66a8ef Fix use-after-free bug
xcb_image_destroy() calls free on m_xcb_image
and then few lines down we access member of
m_xcb_image. Swap order of these two actions.

Change-Id: I01fb43a066459cce462df6af22161c35cef524eb
Task-number: QTBUG-43623
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2015-01-08 01:06:21 +01:00
Thiago Macieira
8190291fb0 Autotest: don't leak a socket every call to QtNetworkSettings::hasIPv6
Change-Id: I87e31945052233cee17460ee6f59c02ec416b27b
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-01-08 01:06:17 +01:00
Oswald Buddenhagen
85af7f4538 use the major qt version for the library stem also in cmake files
amends 7ef2f9f65c.

Change-Id: I1b7a029d8c73f5ce20d216e3b40a7c118eca4891
Reviewed-by: Titta Heikkala <titta.heikkala@theqtcompany.com>
Reviewed-by: Stephen Kelly <steveire@gmail.com>
2015-01-08 01:06:14 +01:00
Kai Pastor
1daa7aff4d Remove extra ';' after QPrint namespace block
The extra ';' causes a warning when gcc is used with -Wpedantic.

Change-Id: I3d99aca6f160e46dbe2173106160474664e06b2c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-01-08 01:06:07 +01:00
Tim Blechmann
099075427b QCoreTextFontDatabase: close memory leak in themeFont
if the CTFontDescriptorRef is already contained in m_systemFontDescriptors
we leak a reference, unless we explicitly release it.

Change-Id: I5b263aa52b4433e7e28cc01164098892cc9cd2ae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-01-07 21:32:05 +01:00
Tim Blechmann
b0088967c3 QCoreTextFontDatabase: release CTFontDescriptorRef references in dtor
QCoreTextFontDatabase::m_systemFontDescriptors owns the references to the
underlying CTFontDescriptorRef objects. in order to avoid a leak, we should
release them

Change-Id: I8fc6c158908e0173696cd91058ac34efb3de01d5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-01-07 21:32:05 +01:00
Tor Arne Vestbø
8f9ced9857 iOS: Raise window level instead of hiding statusbar during VKB scroll
Hiding the statusbar using the normal iOS APIs result in QScreen
reporting new availableGeometry, which is not what we want. The
scroll of the screen is a purely visual effect, and shouldn't
have any effect on observable Qt APIs besides the keyboard rect
changing.

Instead of actually hiding the statusbar, we achieve the same
effect by raising the key window (and any other application
windows, including the keyboard) to the level of the statusbar,
effectively putting them above the statusbar. This still leaves
popups and alert windows above the key window, as normal.

Change-Id: Ib7694240ca86cfb9000de35bf0c49343ffb37e32
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-01-07 21:32:04 +01:00
Daniel Molkentin
83bd9393e5 Fix crash if PAC script retrieval returns a null CFData instance
The documentation for CFURLCreateDataAndPropertiesFromResource()
does not make this clear but from looking at the CFNetwork implementation
and a user stacktrace it appears that this function can return true
but not set the data argument under certain circumstances.

Change-Id: I48034a640d6f47a51cd5883bbafacad4bcbd0415
Task-number: QTBUG-36787
Patch-By: Robert Knight
Reviewed-by: Markus Goetz <markus@woboq.com>
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
2015-01-07 10:29:13 +01:00
Daniel Molkentin
a83e4d1d9d Fix possible crash when passing an invalid PAC URL
This commit checks whether CFURLCreateWithString() succeeded.

It does not appear to be possible to enter an empty URL directly in the
PAC configuration dialog but I can't rule out the possibility
that it could find its way into the settings via some other means.

Change-Id: I6c2053d385503bf0330f5ae9fb1ec36a473d425d
Patch-By: Robert Knight
Task-number: QTBUG-36787
Reviewed-by: Markus Goetz <markus@woboq.com>
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
2015-01-07 10:29:09 +01:00
Daniel Molkentin
ea4dcc5931 Fix crash on Mac OS if PAC URL contains non-URL legal chars
macQueryInternal() was retrieving the PAC URL string as-entered by
the user in the 'Proxies' tab of the system network settings dialog
and passing it to CFURLCreateWithString().

CFURLCreateWithString() returns null if the input string contains
non-URL legal chars or is empty.

Change-Id: I9166d0433a62c7b2274b5435a7dea0a16997d10e
Patch-By: Robert Knight
Task-number: QTBUG-36787
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Reviewed-by: Markus Goetz <markus@woboq.com>
2015-01-07 10:29:06 +01:00
Andy Shaw
e7210a4945 Remove redundant code
The non client mouse events have the right information regarding the
modifiers now so the old code covered with Q_WS_WIN can be removed.

Change-Id: I3e4ebc0debdd66970b18233f189b5d9e880e40a9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-01-07 09:57:21 +01:00
Andy Shaw
bca693e0c1 Remove the -load_all option from the linker enabling static builds
With the -load_all option turned on then it will cause a problem with
the network bearer plugins as they share the same files and on OS X
two plugins will be built and potentially linked against when building
statically.

This only effects gcc builds because clang does not turn this option on
when linking by default either.

Task-number: QTBUG-39238
Change-Id: Ib259304c3da74b6b4f6fcc6e3766427303af3bbe
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
2015-01-07 09:57:07 +01:00
Andy Shaw
bb16ceac68 Prevent buffer overrun when getting the glyph images
The change 35bc3dc45a moved some padding out
of QTextureGlyphCache into the font engines directly, however this was not
done for the DirectWrite font engine so it caused a buffer overrun.

Task-number: QTBUG-41782
Change-Id: I4e643159036f06c5edd8a742dc6694d517a47826
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-01-07 09:42:32 +01:00
Friedemann Kleint
5517d1fde5 Windows: Remove check for minimum/maximum size constraints.
The warning was triggered when increasing the fixed size of a window.
If there is a real violation of the size constraints, the below
warning will show.

Task-number: QTBUG-43420
Change-Id: I85d7d0a91d040aa3ddeff8c3d105351efd5e14a9
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-01-07 09:17:51 +01:00
Friedemann Kleint
58fc02241a Windows: Release mouse capture when window is blocked by modal window.
The capture needs to be cleared when for example a modal dialog
is opened from a timer slot or similar while moving the window.

Task-number: QTBUG-43308
Change-Id: Id0c01080d67d1057004a7f85b037dce5e220de42
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-01-07 09:17:41 +01:00
Friedemann Kleint
d74d0a3b30 Disable ANGLE builds for MSVC <= 2008.
Task-number: QTBUG-43475
Change-Id: If0f68ed6823564fd67219812334256936031f35f
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-01-07 09:17:27 +01:00
Friedemann Kleint
6796f2337e Windows: Fix OS version determination for Windows >= 8
First, try to determine the version of kernel32.dll by
using the version API. If that fails, loop using the
version macros, taking the major version into account.

Hangs in the minor version loop have been observed, potentially
related to the major version.

Task-number: QTBUG-43413
Change-Id: I982e78873510e7598c7cf839177e59812acd86f6
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-01-07 09:17:18 +01:00
Thiago Macieira
cf4b413fa4 Make QtDBus unit tests compile with runtime dbus-1 too
There's a change in Qt 5.4.0 that makes Qt compile with its own set of
D-Bus headers, which means QT_CFLAGS_DBUS may be empty. Thus, we can't
compile or link if we're using the actual libdbus-1 API to build the
test.

This commit makes these unit tests use the same dynamic loading
mechanism.

Change-Id: I56b2a7320086ef88793f6552cb54ca6224010451
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-06 18:16:32 +01:00
Thiago Macieira
1fc4053337 Allow the QtDBus type benchmark to run without libdbus-1 found
Change-Id: I1086e6cd6534dc96311e981cc9c73f501c1128ac
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2015-01-06 18:16:09 +01:00
Thiago Macieira
12d32b017d Complete the work for the runtime libdbus-1 support
Commit a2da88712f was incomplete. Though
it did enable building of QtDBus without the libdbus-1 headers, but it
still kept looking for it. We don't need to do it anymore if CFG_DBUS is
the default (runtime), so skip the actual check.

This commit does not change behavior. All it does is skip the D-Bus
tests if we're about to use dlopen'ed libdbus-1.

Change-Id: I3947443c9ef6cc409cb6b154564f8af6fb5de84e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-06 18:16:08 +01:00
Simon Hausmann
182bb7c3d0 Fix build on Linux when dbus headers cannot be found
When CFG_DBUS != "no", we enable the build of linuxaccessibility in
src/platformsupport, which requires QT += dbus to work. When no dbus
headers are found, CFG_DBUS is set to runtime, which means we'll
enable a11y but "dbus" will not end up in qconfig.pri and therefore
src/dbus is not built at all (and not before platformsupport). Therefore
the build in platformsupport breaks.

So even if CFG_DBUS is set to "runtime" we need to make sure that dbus appears
in qconfig.pri.

Task-number: QTBUG-43205
Change-Id: Ibbe5e66552226cdcc1ce16fb83556406f3bb0e09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-06 18:16:07 +01:00
Orgad Shaneh
a457bf3ff7 Doc: Fixed date format doc bug in QDateTime/Qt namespace
MM stands for month, SS is invalid

mostly cherry picked from Qt4 commit 670f460fab6a386407c07281cf6417ccf6430970.

Task-number: QTBUG-12236
Change-Id: I7af4be655d2d10f1befa1366abb48225c60d31dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-06 17:54:58 +01:00
Thiago Macieira
acf80b9a2b Fix build error with Intel Compiler 15 on Windows
If the constructor is inline, the generated code needs access to the
vtable, which gets emitted with the first virtual function (in QtGui),
but somehow icl.exe can't find it in debug. Looking at the .obj files it
generates and comparing to MSVC, it seems that:

 - both generate and export the inline constructor from Qt5Guid.dll
 - MSVC will call that constructor from qoffscreenintegration.obj
 - icl.exe will inline the constructor and requires a symbol not
   exported from Qt5Guid.dll

I can't explain why (probably a compiler bug).

Change-Id: I0ab9c078ae4fc794826025d68d364124c7247e80
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
2015-01-06 17:48:29 +01:00
Thiago Macieira
9d9b785259 Give ICC-as-Clang a Q_CC_CLANG version number too
Give it version number 3.5 for current compatibility.

Change-Id: Ia023d29b3b3946f8642a0550279ae63cbb803fc5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-01-06 17:39:03 +01:00
Tor Arne Vestbø
2bdcea9d31 iOS: Remove QIOSKeyboardListener self-change assert/guard
We're fairly confident self won't change in that case, and the
assert was causing warnings in release builds.

Change-Id: I4a826579bb4cedef8423e8d43cb370e1f3b80407
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-01-06 17:38:59 +01:00
Thiago Macieira
624ee454ec Make QDBusConnection and QDBusServer return an error on default objects
The error of "Not connected".

This incidentally solves a crash when QDBusServer().lastError() is
called but libdbus-1 couldn't be found.

Change-Id: Id93f447d00c0aa6660d4528c4bbce5998d9186a8
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
2015-01-06 17:37:00 +01:00
Thiago Macieira
aa83bacb14 Autotest: fix a race condition in verifying a peer D-Bus connected
On the unit test side, everything is sequential: we first ask for the
connection, verify that it is connected, then ask the remote side via
the session bus if it is connected. Unfortunately, the remote site may
handle things in a different order: it may handle the incoming function
call to "isConnected" before doing accept(2) on the listening socket.

So, instead, make the local side block until the connection is received
on the other side. On the remote, we don't block, instead we use the
feature of delayed replies.

Change-Id: Ie386938b8b39dd94a9d7e5913668125fb4a3c7da
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
2015-01-06 17:36:58 +01:00
Thiago Macieira
01fc82e357 Re-enable constexpr for ICC 15
The bug noted in d88e4edcd5 appears to be
resolved.

Change-Id: Id20906ff83f74bd16267d44bf447626b81187e71
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-01-06 17:36:49 +01:00
Thiago Macieira
f3e9f11265 Fix change-of-sign warnings with ICC
qlocale_p.h(427): error #68: integer conversion resulted in a change of sign

We hadn't enabled Q_COMPILER_CONSTEXPR for ICC.

Change-Id: Ie7e3070b9f8f2cf512d2745001312865e698596b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-01-06 17:36:47 +01:00
Maurice Kalinowski
f2c247921d windeployqt: add clean step to toplevel makefile
Currently you could only invoke windeployqt for debug and release
builds, but not windeployqt_clean resulting in artifacts after
the clean step.

Change-Id: I3a93e4909a017f3594cc5b0c2249ed25b777c008
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Andrew Knight <qt@panimo.net>
2015-01-06 16:50:54 +01:00
Eskil Abrahamsen Blomfeldt
ce40b8b7ef Android: Fix QCryptographicHash test
Include test data in qrc when building on Android.

Change-Id: I611ca24fe8764eb709b6ce27e814840ea919d4f1
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2015-01-06 16:44:38 +01:00
Eskil Abrahamsen Blomfeldt
8057ce61d0 Android: Fix QCommandLineParser test
Skip the tests that require building and deploying an external
command line application, since that's not how we do things on
Android, and it's really not very relevant for that platform.

Change-Id: I2c1985687e25fb0cf124b1d57c8ba60e37d2ff96
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2015-01-06 16:44:36 +01:00
Eskil Abrahamsen Blomfeldt
4613e1d2c1 Android: Fix QCollator test
On Android the POSIX implementation of QCollator is used, and
this does not support setting other locales than the default.

Change-Id: I25d23949341fc555e8be4f6836ae68cc8813cc46
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2015-01-06 16:44:34 +01:00
Eskil Abrahamsen Blomfeldt
463835b306 Android: Fix QChar test
Include test data in qrc when building on Android.

Change-Id: Id80623324788dac21bd5ddbeef8108f54d6bc8f7
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2015-01-06 16:44:32 +01:00
Eskil Abrahamsen Blomfeldt
6a4704cc64 Android: Fix QByteArray test
Include test data in qrc so it can be found on Android.

Change-Id: Iaca8422120f1ef842aafeb0cc209cb9fdd70f05f
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2015-01-06 16:44:30 +01:00
Eskil Abrahamsen Blomfeldt
75f0578124 Android: Fix QTranslator tests
Bundle test data in qrc on Android. Extract it, as the tests
expect to find it in the file system.

Change-Id: I251eca3c23141a608b1cbac5ee0b7164c068f9b4
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2015-01-06 16:44:27 +01:00
BogDan Vatra
af32727362 Android: Check XML output and optionally stop on fail.
The failures will be printed in red color.
Use -f param to stop on fail.

Change-Id: Ife58f9264a9ac859d739842c6d1359acde807ce7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-01-06 14:26:39 +01:00
Friedemann Kleint
16c32c6dfb JPEG: Fix reading of EXIF orientation.
The orientation is unsigned short, read it as such. In
JPEG-files created by Ricoh/Pentax cameras, the data is saved in
Motorola format. Reading the wrong data size will produce invalid
values when converting the byte order.

Change-Id: I8f7c5dc5bfc10c02e090d3654aaefa047229a962
Task-number: QTBUG-43563
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-01-06 14:26:00 +01:00
Sérgio Martins
38a3158d2f Windows: Fix QColorDialog's live updates while picking outside color
Microsoft's SetCapture() doesn't work on windows owned by other processes,
so instead we use a timer. This is the same approach as used by qttools/src/pixeltool.

The mouse move approach however is more elegant and doesn't hammer the CPU with
QCursor::pos() calls when idle. For this reason the workaround is Q_OS_WIN only.

Task-number: QTBUG-34538
Change-Id: I40a6f7df5bf2a3a29ade8fe4a92f5b5c4ece7efb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-01-06 14:22:21 +01:00
Thiago Macieira
b699ac070c Don't bind to QHostAddress::Any if we want to do IPv4 multicast ops
Linux gracefully allows us to do that and treat the v6 socket as if it
were v4. Other OS (notably OS X) aren't so forgiving.

Change-Id: I13dd3274be2a4b13e8b1eef93cbc2dd17b648f96
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-01-05 08:07:10 +01:00
Marc Mutz
4560ce4ec6 tst_QLockFile: simulate a crash better
Instead of leaking the QLockFile instance, which causes
leak-checkers to emit false positives, simply call exit(),
which doesn't run the destructors, yet doesn't lead to
leak-checker warnings.

Change-Id: Ia61010671e5218ae412e2bcf873e66255a2c5a99
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-04 09:43:25 +01:00
Marc Mutz
d7fa2d060a Fix a memleak in QAssociativeIterable::value()
QtMetaTypePrivate::QAssociativeIterableImpl::{find,begin,end}() allocate a new _iterator,
so when they're used outside of the ref-counted world of QAssociativeIterable::const_iterator,
their lifetime needs to be manually managed.

Instead of going to that length, which failed in previous iterations of this patch, implement
value() in terms of (new) find() and let find() operate on const_iterator.

Because of forwards compatibility between patch releases, use (unexported) friend functions
for now with the intention to make them proper member functions come Qt 5.5.

Task-number: QTBUG-41469
Change-Id: I43b21eae0c2fc4c182369e669a8b3b457be68885
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-04 02:20:32 +01:00
Raphael Kubo da Costa
350c60b79e Link against QMAKE_LIBS_EXECINFO when using backtrace(3).
Add a new mkspec variable, QMAKE_LIBS_EXECINFO, for platforms where
backtrace(3), backtrace_symbols(3) and others are not in libc, but
rather in a separate library -- on the BSDs, this is libexecinfo.

Use it in corelib/global/global.pri so that libqt5core links against it
and has the proper dependency when necessary.

Change-Id: I62ac36c9b3ba7ab0719420cb795087d43ec138a4
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-01-03 14:48:53 +01:00
Thiago Macieira
86ca4de8a2 Doc: fix the type listed for the functions in QAtomicInteger
The "int" was a left over when this was documentation for QAtomicInt.

Change-Id: If7b7688982d27cbbd42f080eff7d08344b587f44
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-01-02 17:50:17 +01:00
Thiago Macieira
9b869cfb01 Autotest: Forward stderr of the sub-processes
So we can get the output when running with QDBUS_DEBUG=1.

Change-Id: I6a6b8e0d82727c522914fb90a7ce594c86307d8f
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2015-01-02 17:25:24 +01:00
Thiago Macieira
6d3558b449 Autotest: Be nicer when asking the sub-processes to exit
Instead of killing them outright (and note that terminate() doesn't work
on Windows), ask them nicely to exit on their own. This way, if we run
them in valgrind, valgrind gets a chance to print the leak check output
and summary.

Change-Id: Ib6cc8d4560ff0bf255f94980eb220e97592c00f0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2015-01-02 17:25:01 +01:00
Israel Lins
5fefec9136 Added ROUND test for PostgreSQL
The ROUND function for PostgreSQL only accept NUMERIC field as argument

Change-Id: I0c3753bfe4167cd47158e21b407cca8771816104
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2014-12-30 23:56:13 +01:00
Israel Lins
b60773934d [QDateTime] ISO Time zone designators can be [+-]HH
Added support on QDateTime::fromString to read correctly dates on ISO
format with Time zone designators at format [+-]HH

Change-Id: Ied5c3b7950aee3d0879af0e05398081395c18df5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2014-12-30 23:56:01 +01:00
Maximilian Hrabowski
a44749855e QODBC: fix converted string values empty SQLServer 2012
SQL Server 2012 Native Client (version 11.0.2100.60) or later introduced
a change in the behavior of the SQLGetData method when converted string values
are involved. In older version a (sometimes wrong) size was returned. Now always
SQL_NO_TOTAL is returned which signals to read as much data as available.
SQL_NO_TOTAL was handled like SQL_NULL_DATA in the code before which indicates a
NULL value so the returned string was empty.

See link for more info: http://msdn.microsoft.com/en-us/library/jj219209.aspx

Change-Id: Ia0d2296caf593890b301ee1848d1bf3eb8d7b6fe
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2014-12-30 23:55:51 +01:00
Julien Blanc
190f64aab3 Added timezone support for datetime fields in PSQL
This patch adds correct timezone support in PSQL plugin. Prior to this
patch, no timezone support was provided, so only the following case
worked :
 * using local time in both client application and postgresql server
 * datetime were using second precision

This patch tries to take care that postgresql has two different
datatypes for date time, respectively :
 * timestamp with time zone
 * timestamp without time zone

Both are internally stored as UTC values, but are not parsed the same.
 * timestamp with time zone assumes that there is a time zone
   information and will parse date time accordingly, and then, convert
   into UTC before storing them
 * timestamp without time zone assumes that there is no time zone
   information and will silently ignore any, unless the datetime is
   explicitly specified as having a time zone, in case it will convert
   it into UTC before storing it

Both are retrieved as local time values, with the following difference
 * timestamp with time zone includes the timezone information
   (2014-02-12 10:20:12+0100 for example)
 * timestamp without time zone does not include it

The patch does the following :
 * parse the date retrieved by postgresql server using QDateTime
   functions, which work correctly
 * always convert the date to UTC before giving it to postgresql
 * force time zone so that timezone information is taken into account
   by postgresql
 * also adds the milliseconds when storing QDateTime values

The following configurations are tested to work :
 * client and server using same timezone, timestamp with or without tz
 * client and server using different timezone, timestamp with tz

The following configuration will *not* work :
 * client and server using different timezones, timestamp without tz

Because data will be converted to local time by the postgresql server,
so when returned it will be different from what had been serialized.
Prior to this patch, it gave the illusion to work because since TZ
information was lost, time was stored as local time from postgresql.
Lots of inconsistencies occurred, though, in case client tz changes...

I don't expect this to be an issue since having different TZ in server
and client and *not* handling this is a broken setup anyway.

Almost based on changes proposed by julien.blanc@nmc-company.fr

[ChangeLog][QtSql] Added timezone support for datetime fields in PSQL

Task-number: QTBUG-36211
Change-Id: I5650a5ef60cb3f14f0ab619825612831c7e90c12
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2014-12-30 23:49:14 +01:00