network: fix multi-phased NTLM authentication

tested manually with internal NTLM proxy.

Patch-by: Jonathan Lauvernier <Jonathan.Lauvernier@gmail.com>

(cherry picked from commit 338da730e8bc23e227e26b094cba6bb6233c42de)

Change-Id: I889056545b60deccf55053c2b41ecb1ea0cba62d
Reviewed-by: Richard J. Moore <rich@kde.org>
BlackBerry: improve BPS event lifetime management

In QEventDispatcherBlackberry::select(), if an event handler called
through filterEvent() starts a nested event loop by creating a new
QEventLoop, we will recursively enter the select() method again.
However, each time bps_get_event() is called, it destroys the last
event it handed out before returning the next event.  We don't want it
to destroy the event that triggered the nested event loop, since there
may still be more handlers that need to get that event, once the
nested event loop is done and control returns to the outer event loop.

So we move an event to a holding channel, which takes ownership of the
event.  Putting the event on our own channel allows us to manage when
it is destroyed, keeping it alive until we know we are done with it.
Each recursive call of this function needs to have it's own holding
channel, since a channel is a queue, not a stack.

However, a recursive call into the select() method happens very rarely
compared to the many times this method is called.  We don't want to
create a holding channel for each time this method is called, only
when it is called recursively.  Thus we have the instance variable
d->holding_channel to use in the common case.  We keep track of
recursive calls with d->loop_level.  If we are in a recursive call,
then we create a new holding channel for this run.

Backport from qtbase/5cc76dae7e985a7a39d839524dc8ad6475e597f3

Change-Id: Ib3584676d2db5a9a3754a1535d5fb6c9e14f5dbc
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Fix resetting of string properties.

Task-number: QTBUG-34171
Change-Id: Ib5fe8194d891eb999e41bafde19834be56c84103
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
(cherry picked from qttools/78d8ee2513bdf52da2e0141be93dfe7bab8a1488)
Keep web fontdata alive as long as CG uses it

With OS X 10.9 font decoding appears to happen lazily, this means we
have to ensure the data we provide CG is kept alive until CG dereferences
it itself.

Backport of 89ab2671051671ecf440ba480caf0b6b6768b1a9

Change-Id: I29d5bf9d6efac4668ea2c85fa5393ed1c1e621b5
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Make QCoreWlan plugin compile on 10.9

Backport of 79ccb4fc from Qt 5:

We take the path of least resistence and keep the old API code for 10.6 while
updating the code for 10.7 and newer. This means we have some code duplication.
It also means that we only compile the 10.6 code for QCoreWlanEngine when the
deploymen target is 10.6.

The 10.6 version file should be removed once we drop support for Snow Leopard.

Change-Id: I07284a2579ba127abdca660ad4b8573576756399
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>