Fix QPainter::drawPolyline() painting errors with cosmetic pen

Task-number: QTBUG-31579
Change-Id: I8fd2c03ff9a22e4963bfcbcfe196ae4c61b9e10f
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
(cherry picked from qtbase/319cbb7597100f3b65792dc6a0ce2885ce6c0e8c)
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Allow Qt4 to also build in ppc64[el le]

This simple patch allows ppc64le (aka ppc64el) to build Qt4.

The original patch was done by Ubuntu's William Grant [0], but
I higly doubt this is copyrighteable.

[0] <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749743#39>

Change-Id: I4cd204e314789337e34b460dda6e18143e3712ec
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Fix AArch64/arm64 detection.

The detection needs to go before arm, else the system will detect AArch64/arm64
as arm.

This patch comes from Wookey, he has agreed to put it under BSD or Expat
to allow it's inclusion in here:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735488#255>

Change-Id: Ic2171c03fca8bb871347940fa3a2bc467776f797
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Replace all ocurrences of NSApp with [NSApplication sharedApplication].

The former returns an id and the latter returns an NSApplication*. This
gives us the benefits of static typing and resolves a build error on
OS X 10.10.

Task-number: QTBUG-39644
Change-Id: I62939b168f391beb846f8a1c5ae789e45bceb858
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Don't call virtual methods after the source model is destroyed.

Calling clear_mapping causes the persistent indexes to be queried, and
mapped using map_to_source, so that they can be restored later. That
is not the appropriate response to the source model being deleted
because there won't be anything to restore.

Simply clear the stored mapping information instead so that the source model
actually exists when mapToSource is called by the framework.

Backport of 722798a359761a1eb635d18547b076615f192508 from qt5/qtbase

Change-Id: I9c74f97855046b968dfba7a35134c234b974e63b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
QSwipeGestureRecognizer: Use qAbs() to check distances.

Task-number: QTBUG-15768
Change-Id: Idc6c6687430365a015fb2c15f4e4dcae6a687f9f
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
(cherry picked from qtbase/74303ad497ff0e3a9876d349e2ce2f67f08c0fbf)
Revert previous QFileDialog fix for Solaris

This reverts previous commit 6d47f5a168e350a6d9cbddb343ff9d75ffbd2c04,
that broke compilation of QFileDialog in solaris (Sun CC).

Solaris defaults to Draft version of getpwnam_r if _POSIX_C_SOURCE is not
defined or < 199506L, and _POSIX_VERSION is defined as 199506L even when
_POSIX_C_SOURCE is not used, so it cannot be used to detect correct
posix support.

Task-number: QTBUG-21451
Change-Id: Ibbf2b9de1dea74e7d8b6003d1a4e3686e5858525
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Milla Pohjanheimo <milla.pohjanheimo@digia.com>
Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
Fix font cache check in QFontEngineFT::recalcAdvances()

Cached font was used regardless of the format, resulting in incorrect
advance in some cases when default format differed from the cached
format.

Task-number: QTBUG-24188
Change-Id: I39e4156bd9ba743afa7e106e934c90227fbf2b8b
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
(cherry picked from qtbase/2ea976c3a713535c2419d936d575e0b24545f0fa)
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Lisandro Damián Nicanor Pérez Meyer <perezmeyer@gmail.com>
Reviewed-by: Jiang Jiang <gzjjgod@gmail.com>
QListView: Catch stack overflow on mutual scrollbar calculation.

Backport of fc4993be1fa7673016b6e5d81134463f163051f6 from Qt 5.

Task-number: QTBUG-39902
Task-number: QTBUG-38517
Change-Id: I66b2c7304423dd65d67158ae0dc70ad12e4fa783
Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
admitting defeat

(cherry picked from qttranslations/b9a22c997c1a988ff8e6b52893e4673e9ac69a2b)
Change-Id: I050998c14f4053a5c006d7a0da8b8befb21902b0
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
QPdf::addImage(): avoid a QImage detach when it's in an acceptable Format

Don't detach QImage, when it's in Format_Mono or Format_ARG32.
Use QImage::constScanLine() instead of QImage::scanLine().

Change-Id: I30fcafb576aea3189637a40fd75f77c70017ba46
Reviewed-by: John Layt <jlayt@kde.org>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
(cherry picked from qtbase/1a32cc0ae42a4a49f2d45b8ad8251ec40a30bf76)
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
OSX: make QFileDialog::getSaveFileName honor the initial file name.

Since OSX 10.9 the NSSavePanel will call panelSelectionDidChange on the
delegate when the selection is changed programmatically, even when the
panel is not (yet) visible. This overwrites the selected file name
with the default "Untitled" before we'd set it in
runApplicationModalPanel. The fix is to check if panelSelectionDidChange
is called before it is shown.

Change-Id: I9ad6cd3afddc0aac35baebab31fd85cd7bf3f9e9
Task-number: QTBUG-36212
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Fix crash when accessing the content model.

1) Make sure invalidateContents() is called whenever the help engine's
   DB readers are destroyed.
2) In QHelpContentProvider::stopCollecting(), remove all root items, as
   they are invalid now: Their child items reference DB readers that
   are going to be destroyed.

Task-number: QTBUG-18829
Change-Id: Iab3245eb9fd405f28105aa08a976d9a108b9c70a
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Fix DateTime with recent versions of tzdata

An backport of http://trac.webkit.org/changeset/150833 needed for
correct time KRAT, YAKT and MOS timezones.

Task-number: QTBUG-41422
Change-Id: I6e9d1db690fee8d77faa1d76c836bd7b345ce854
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Fix libmng test.

libmng pulls in libjpeg. In turn libjpeg requires that code that uses it should
include stdio.h [0].

[0] <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=461602#10>

So adding the corresponding include before libmng solves the issue.

(cherry picked from qtimageformats/08f40bc0f00716c3a8cbda70ed00dc2f16515e85)
Change-Id: Ib249fa9d867536c19be8e376f6c5595080cab006
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
QLineEdit: Disable standard key 'cut' when there is no selection.

(cherry-picked from qtbase/0aa84a619ea0a7c85a1ed48ed28817d4c7e40b33)
Task-number: QTBUG-40477
Change-Id: I48aa7ecc4ee8a8e4e9feaf9b6cba5109d2d1f725
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Backport: use backslashes for UNCs path

ShellExecute fails to open a share folder due to using '/' instead of '\'.

Windows API doesn't support forward slashes for extended-length path.
Extended-length path are path that start with a "\\?\" prefix. For example,
"\\?\c:\very_long_path\foo\bar.txt", or in the case of a UNC path that
would be "\\?\very_long_path\foo\bar.txt". [1]

[1] http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#maxpath

(cherry-picked and adapted from qtbase/18c916517f3004d34482c20ed66bf09ec274d385)
Task-number: QTBUG-13359
Change-Id: I2f38ecb76d87b87dc1d40bd48c94c78550a6ca1f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Update Hebrew translation

Change-Id: I9a4d4f236cfca386f717629b09a23e51baab6bd5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Make sure the content widget never replaces valid data with empty data.

This could happen because insertContents() is called once for
every run of the content provider, even if an invalidation happens
in between. Example sequence:
    run()
    invalidate() [removes result of first run]
    run()
    insertContents() [queued for first run, retrieves result of second run]
    insertContents() [queued for second run, retrieves empty data]
We now check in insertContents() whether the content provider has a
valid root item and do nothing if it does not. This means that
insertContents() will never replace the current model data with empty
data; only invalidateContents() can do that from now on.
Further improvements:
    - Only call insertContents() if the run was not aborted; this
      reduces the number of useless objects in the event queue.
    - Remove the m_rootItem member; it was only used in the run() function.
    - Only add the root item to the list at the end of a successful run;
      there is no reason this object should be accessible from the outside
      while there are still children being added to it.

Change-Id: I80e2ea93dd9bbc8ab7f406c989b61f16f11b6eea
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
QMacStyle: Fix QTabBar appearance on Yosemite

The selected tab text color should be white except when the
window is not active. Also, no text shadow should be rendered
in any case. Finally, there's no need to move the tab shape up
anymore.

Backport of qtbase/e9e66079b16754f1fef89c2ad93593d7d55c8654

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