Commit Graph

9817 Commits

Author SHA1 Message Date
Thiago Macieira
f89fd779fc Overhaul a little the QUrl error reporting.
Keep the original QString that triggered the parsing error, instead of
just one QChar. This provides more powerful error messages, like:

 Invalid IPv6 address; source was "http://[:::]";  scheme = "http", host = ""
 (QUrl cannot keep invalid hostnames)

 Invalid port or port number out of range; source was "http://example.com:abc";  scheme = "http", host = "example.com"
 (QUrl cannot keep a non-numeric port number)

 Invalid path (character '%' not permitted); source was "foo:/path%?";  scheme = "foo", path = "/path%25%1F"
 (the tolerant parser runs first, so the faulty component is fixed)

This stores the error state in a special structure which is not
allocated under normal conditions, keeping the memory consumption
down. On 32-bit systems, QUrlPrivate does not increase in size; on
64-bit systems, it grows by 8 bytes.

Change-Id: I93d798d43401dfeb9fca7b6eed7ea758da10136b
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
4f52a95099 Update some error messages in QUrl::errorString()
Make both invalid hostname messages start with "Invalid hostname". And
split the empty port error from the invalid port one.

Change-Id: I870d1ed6fb07ec494f553871a37ed167141ffc06
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-10-02 22:34:42 +02:00
Thiago Macieira
7b696e4ec7 Add Q_UNREACHABLE / Q_ASSERT to two conditions that can't happen
Just so the code generation is a little better.

Change-Id: I2a43a4df0ae67900c465a6c2b4f2b8ba284dbbaa
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
1fc902ac7e Move QUrlPrivate to qurl.cpp and mark all methods as inline
They're never accessed outside of qurl.cpp anyway, so let the compiler
know that it doesn't need to generate a full out-of-line copy for them
in case it does inlining.

Change-Id: I2be069b3fd2658eff9ad3023c21c8ae653c389ab
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
9bbccf5d74 Change QUrlPrivate::setAuthority to return void
It used to return bool because setHost returns bool and, therefore,
setAuthority could fail. However, the return value is never checked,
in either parse() or QUrl::setAuthority(), because there's no error
recovery.

This is a small optimisation.

Change-Id: I25660d66cfad64ca5b9706cc38afa0e97ba3ee0b
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
ceca141d0c Remove the annoying qWarning when QUrl::setPort is out of range
That's what we have QUrl::errorString() for. This will become evident
especially now that QUrl::toString() / toEncoded() return empty if
there are errors.

Change-Id: I64a84e9c6ee57c0fc38cc0c58f5286ddc1248d1f
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
fe1541b268 Update QUrlPrivate::setScheme: EmptySchemeError never happens
As the comment says, an empty scheme is not permitted. However, if
that error were to happen, QUrl falls back to parsing the URI as an
"URI reference", starting with the path.

E.g., ":/foo" is a path of ":/foo", which will in turn trigger the
compound "colon before slash" error.

Also, we don't percent-decode in the scheme.

Change-Id: I438a61e17323c7722ddcc64792577a9ecb869c4b
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
59ad0019dc Make QUrl::errorString() usable for QtTest output in invalid URLs
If an URL is invalid, let's indicate that in the test output. To be
helpful, let's make QUrl::errorString() include the component form of
the URL.

Change-Id: Iaafe16973ded79c7ea688fbb23808d91253e8c14
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
adce435a0c Make QUrl::toString() / toEncoded() return empty for invalid URLs
Change-Id: I6ebb4ad2901a9bacb09fb81082202f37ebbc2e97
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Thiago Macieira
7d62f8ace5 Add two compound URL invalidity cases for isValid()
These two errors can only happen if one calls setPath() explicitly. They
cannot happen for parsed URLs, which is why they are only caught with
isValid(). It's not possible to set the error condition in setPath()
either because they depend on the presence / absence of the authority
and scheme.

Also update all the unit tests that set a path not starting with a slash
and were just "freeloaders" on the previous behaviour.

Change-Id: Ice58cd4589a850452d7573a5b19667bbab2fb43e
Reviewed-by: David Faure <faure@kde.org>
2012-10-02 22:34:42 +02:00
Friedemann Kleint
a0af0fbcd4 Fix DIB image reading.
Position the QIODevice correctly for DIB (==BMP without file
header).

Task-number: QTBUG-26690
Change-Id: I7922b4e830a92dcc19f1b52e305ca9ff3fd5d9f5
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2012-10-02 19:54:43 +02:00
Mark Brand
7c382d81d9 fix #includes
Change-Id: Ia33d7ef08e43bad95d57823e37757a09e53493b9
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-10-02 15:57:58 +02:00
Jens Bache-Wiig
4dac6fc70a Remove Cleanlooks as a dependency of QGtkStyle
Since we no longer do the sanity checking against
gtk-qt-theme at startup, there
is no longer any need to inherit from cleanlooks.

Cleanlooks should no longer be needed as it has been
completely replaced by Gtk style and this dependency
is not required at this point.

Change-Id: I05b59278cd3ff915df49a7ad2d04494258db0d42
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
2012-10-02 13:22:49 +02:00
Morten Johan Sorvig
98ad8460a8 Set CWD when launched from Finder.
Like Qt 4. Use the presence of the "-psn_" command-
line argument to detect Finder launches.

Link QtGui against the Cocoa framework due to CFBundle
usage.

Change-Id: I947ae53462072fbdb23afcc0a13ce6b26d02c191
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2012-10-02 13:22:49 +02:00
Richard Moe Gustavsen
903bd6250a Cocoa: add missing auto release pools
Got complaints while running file dialog example. Adding in
the release pools will fix the problem.

Change-Id: Ib33fddd5aedfc3e4aaa6fdd8995bbc8c8098267c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
2012-10-02 13:22:49 +02:00
Richard Moe Gustavsen
2570c081a1 Cocoa: bugfix staysOnTopFlag in combination with transient parent
A staysOnTop window with a parent would never stay on top. The reason
was that we placed the window on the same level as the parent, which
would undermine the staysOnTop flag.

The fix for this is to always level the window to _at least_ as the same
level as the parent, but never lower. A code path for this already
existed in the windowLevel function for popups. so we factor that out
and use it for all cases.

Task-number: QTBUG-27410
Change-Id: I0c30194be33703f54b6c2fe7f3088a9febcd1e2c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
2012-10-02 13:22:49 +02:00
Jocelyn Turcotte
341dcae472 Fix a crash with xcb on 64bit systems when hitting any key.
xcb uses 32bits for xcb_keysym_t, but Xlib uses 64bit longs on 64bits
systems for KeySym and all other XIDs on the client side. Passing
an xcb_keysym_t* to XLookupString, expecting a KeySym*, would overwrite
the next 32bits in memory and possibly cause a crash.

This patch makes sure that a KeySym* is passed to XLookupString, and use
the signature declared in Xutil.h to make sure the types are right.
Encapsulate it in qxlibconvenience.cpp since including Xutil.h inside
qxcbkeyboard.cpp causes macro expansion problems.

Change-Id: I68451a24cb44a43dfa4382b5dce1ea7845f14e26
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Laszlo Papp <lpapp@kde.org>
2012-10-02 13:22:49 +02:00
Gatis Paeglis
e840b8b2e3 Stop delivering messages when drop has occurred.
Task-number: QTBUG-27406

Change-Id: If14c108060ad6de70991658f0e0249eb544b87a0
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-02 13:22:49 +02:00
Gatis Paeglis
5ba061a66e Retrieve drop data with a proper timestamp
Occasionally drag-and-drop was returning empty mimedata due to
using wrong value for timestamp. Accoring to the xdnd specification
we must use timestamp from XdndPosition or XdndDroptime for retrieving
the data.

Task-number: QTBUG-27367
Change-Id: Iadb6b6989cfc4e8ab241e2fd0ded59355108f22f
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-02 13:22:49 +02:00
Gatis Paeglis
caaa94b041 Ensure that QDrag is set correctly at all times.
This patch fixes broken code in handleSelectionRequest(). There are 2 cases
when this function is called:
1) When XdndDrop has arrived (on mouse release)
2) When drop has not occurred yet (while mouse are still pressed down)

Second case was not working due to this bug.

Task-number: QTBUG-27405
Change-Id: I913cfd332128a28861e2fcc027b406eb821d2597
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-02 13:22:49 +02:00
Gatis Paeglis
03fd3a8f34 Fixed xdnd protocol-version detection code
Bug introduced when porting from Xlib to xcb. Xcb returns
actual number of bytes read while Xlib returns number
of 8-bit, 16-bit, or 32-bit items stored in the returned data.

Task-number: QTBUG-27403

Change-Id: Ia64da1953ec7be8d32cc591565cd1b41ce8d7dbb
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-02 13:22:49 +02:00
Thomas Hartmann
ad41111167 QProcess.tests: adding test for channel forwarding
This tests QProcess::setProcessChannelMode().

The tests verifies if testForwarding really forwards
the output of testProcessEcho (spawned by testForwarding).

Change-Id: Ifc4164569256aeaeab0edef42116986272362c01
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-10-02 13:22:49 +02:00
Gatis Paeglis
a5e3e9eaf1 Don't let mimeData return 0.
Fixes bug introduced in SHA e247e2810 (QTBUG-26709).

Change-Id: I9aa80239675b2d564d08a019ca267a9aa814074e
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-02 13:22:49 +02:00
Friedemann Kleint
a1915fbb52 Fix filter regular expression for native Windows file dialog.
Task-number: QTBUG-26986

Change-Id: Idbbaca4ea4fc298c50a30671c48b597ac38d3308
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
2012-10-02 13:22:49 +02:00
Sean Harmer
eeaf00b24a OpenGL: Propagate version and profile from QSurfaceFormat to QGLFormat
Change-Id: I386ec75c429f58309527532bb160679ea51e6ccc
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-02 10:43:48 +02:00
Stephen Kelly
8b41a29b2d Forward the layout change hint through QSortFilterProxyModel.
Change-Id: Ic9ae7f011f63c4a53fec4d9425ac6cd6776153ee
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2012-10-02 10:43:48 +02:00
Samuel Rødal
12590582a2 Fixed text drawing in OpenGL 2 paint engine.
Regressions introduced in 8d762c9cae and
f4c1c2f939.

Task-number: QTBUG-24453
Change-Id: Ib1cb05693cde2d6066476a350eb95eaa503ee53c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2012-10-02 10:43:48 +02:00
Samuel Rødal
9b201853ad Made cube example not use glActiveTexture.
We're setting the default texture unit anyway, and glActiveTexture would
require resolving through QOpenGLFunctions.

Task-number: QTBUG-24555
Change-Id: Id8d660baaa1532e7b8e623673f501703c76fac65
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-10-02 10:43:48 +02:00
Andy Shaw
ef3a544436 Rename createLocalFile to createNativeFile & deprecate createLocalFile
As it was confusing to use the term local file when referring
to a file that was accessible using native APIs and not just
a file that was on a hard disk somewhere already the function
name has been changed.

By renaming it to createNativeFile we keep it consistant with QFileInfo
which has an isNativeFile() function too.

Test also added.

Task-number: QTBUG-3169

Change-Id: I410e7ed28133d68fd312c6c0faf3f7191460d7ce
Reviewed-by: João Abecasis <joao@abecasis.name>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-10-02 10:43:48 +02:00
Joerg Bornemann
f20266f9f4 fix QWidget::setWindowFilePath on Mac OS
Task-number: QTBUG-27299

Change-Id: I4dddbb9690aac327ad33477d8cea9afa84d10eb3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2012-10-02 08:06:24 +02:00
Joerg Bornemann
24c403a2bd QWindow::setWindowFilePath added
QWindow::setWindowFilePath sets the file path of the document
that is currently represented by the window.
The window system might display it in the window's title bar
along with an icon matching the file type.

Task-number: QTBUG-27299
Change-Id: I8f620d1262fc0b4cd16884198b16853b73ce3b1f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2012-10-02 08:06:18 +02:00
Joerg Bornemann
07c95ad7f3 typo fixed in tst_QLocalSocket::verifyListenWithDescriptor_data
Change-Id: Ic549c8fa7f98052a45b391d6a9bfef3d2557c709
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2012-10-02 08:06:11 +02:00
Joerg Bornemann
49a9c50ea8 QWindowsPipeReader: use CancelIoEx on Windows >= Vista
This cancels only the I/O operation of the reader and not all
operations on the handle.

Change-Id: Ie442199534cf45e58bb2e053da9fecee961a460e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-10-02 08:06:06 +02:00
Joerg Bornemann
618c5f854f QWinOverlappedIoNotifier test for multiple I/O operations added
tst_QWinOverlappedIoNotifier::multipleOperations starts asynchronous
read and write operations on the same named pipe handle.
The received notifications must contain the right byte count and
OVERLAPPED pointer corresponding to the I/O operation.

Change-Id: I6f3fa5cf3ca6d62fcb9bc7073d28611fcfa7d98a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2012-10-02 08:05:58 +02:00
Joerg Bornemann
94dc0c6594 QWinOverlappedIoNotifier: multiple I/O operations on the same handle
When doing multiple I/O operations on the same handle, we get notified
for every operations. These must be distinguished by comparing the
pointer to the OVERLAPPED struct.

We now pass the OVERLAPPED pointer via the notified signal and let the
receiver decide if it wants to handle this notification.

Change-Id: I4efe70f39c6ae5282b949f2f4b21f6e7dd3df785
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-10-02 08:05:55 +02:00
Joerg Bornemann
d3c24d241e remove tests/auto/network/socket/qlocalsocket/example
The programs in the example isn't used in the test.
Examples should be in the right directory and be of a certain
quality.

Change-Id: Id77bd1295efb3387fa54c379eb9c882cdc5b88bd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-10-02 08:05:48 +02:00
Joerg Bornemann
1cf6bbfcf1 make tst_QLocalSocket::listenAndConnect faster
Replaced qWait/QCOMPARE with QTRY_COMPARE.

Change-Id: Ic534443c187f791c75fe9528251bf47e54f33eed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-10-02 08:05:45 +02:00
Thomas McGuire
e5d6268f12 QNX: Also support input method hints from QtQuick elements
Turns out some QtQuick elements have the "inputMethodHints" property
as well, so don't only accept input hints for widgets.

Change-Id: I81a14be20cdca7d993dc88e8e252ecdfde8eb4ea
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-10-01 16:19:27 +02:00
Friedemann Kleint
ff3e2fbe21 Document QPA implementation aspects.
Change-Id: I4fef8a534b145efa9655a9070f790bf9aba030d9
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-01 16:03:48 +02:00
Samuel Rødal
39a06115b6 Fixed Qt GUI landing page.
Change-Id: I9af2ed12e27c00060a6bcc6262064ee95295a8a8
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-10-01 15:59:10 +02:00
Yoann Lopes
65d4dea41a QXcbWindow: Don't recreate window when reparenting.
For consistency, this behavior has been kept across Qt versions... Just
get rid of it.
Also fixes native child widgets not being notified of the change of
window handle (winId) when being reparented.

Updated auto-test.

Change-Id: I3616dc0f1c32a519d78a4846297d6d4a6e926fbf
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-10-01 15:48:08 +02:00
Simon Hausmann
310031188c Fix moc stumbling over gcc __attribute__ extensions
Reported by David Faure.

In KDE a DEPRECATED macro gets defined in a header file created by cmake.
The define is not guarded with #if Q_CC_GNU or similar because at cmake
time the compiler is determined. Therefore moc suddenly sees this gcc
specific token and stumbles over it.

This patch simply defines an empty __attribute__ macro that will expand
to nothing and thus become invisible to moc's "C++ parser" after the
pre-processing.

Change-Id: I4448b9ac3f72b6334e32b27484401fb0fca23a0c
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-10-01 14:27:14 +02:00
Peter Hartmann
291e1a9e67 QNX: change suffix for separate debug files
QNX uses .sym for files containing debug symbols.

Change-Id: Ieb995ae90af771ff5c877213f4f4982169f333c6
Patch-by: Greg Bentz
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-10-01 10:34:24 +02:00
Peter Hartmann
80f6d7862c Blackberry mkspecs: Refine compiler options
stack-protector-strong gives performance benefits over
stack-protector-all and is still checking more than -stack-protector,
so seems to be a good middle way and we want to use it when it is
there.

The -shared option for the compiler (not the linker) prevents a
RIM internal version of qcc from forcing -fPIE, and should not harm
in general when set.

In addition, add a method "compilerSupportsFlag" for Windows as is
present in the Unix configure script.

Change-Id: Iba300e9cb82f34043e7b36f8e45287a1aed2a1a5
Original-patch-by: Greg Bentz
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-10-01 10:22:06 +02:00
Friedemann Kleint
c6271071b4 QPA/Windows example: Set proper window flags, titles, names.
Do not leak windows.

Change-Id: I3af29ce597742cbe6444208aa72443c0507819db
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
2012-10-01 10:20:09 +02:00
Samuel Rødal
af83eecd76 Fixed qglxconvenience.cpp compile for GLX 1.3.
These defines are new in GLX 1.4, earlier they were ARB extensions.

Task-number: QTBUG-27370
Change-Id: I83828067d106e93a3909de46a4051d492e277ba9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-10-01 09:54:27 +02:00
Rafael Roquetto
04d296d641 QNX: Only set parent window if it is not NULL
There are cases where a widget has a parent, but is also a toplevel window at
the same time, causing the system window to have no parent.
For instance, a QMenu usually has a QMenuBar as a parent, however QMenuBar
itself does not have its own platform window, as opposed to QMenu. Thus
QMenuBar::parent == QMainWindow (for example), but QMenuBar::platformWindow ==
0x0; QMenu::parent == QMenuBar, but QMenu::platformWindow != 0x0 (which is
QMenuBar's value).

Change-Id: Ib203fa1b85f5f20ef53366c80d6752d6384a202d
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
2012-10-01 09:41:35 +02:00
Stephen Kelly
1511fb37cf Return QPersistentModelIndexes from QItemSelectionRange.
They are stored as such anyway, and this allows clients to not have to
convert between QModelIndex and back so much. This should be
fully source-compatible.

Change-Id: Ia606ea082442089a0aae1583380c3710ce61d3d1
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2012-10-01 09:38:31 +02:00
Stephen Kelly
308987fb96 Emit layout change hint from QStandardItemModel.
Change-Id: I6d6a8c146b63c57634ae6b26ed5c1de249aa9e66
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2012-09-30 18:30:05 +02:00
Stephen Kelly
5b96f53137 Emit layout change hint from QStringListModel.
Change-Id: I8b4a01cfcca59103f2616b72645994a22bff40dd
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2012-09-30 18:29:59 +02:00