The new QUrl is able to distinguish a URL component that is empty from
one that is absent. The previous one already had that capability for
the port, fragment and query, and the new one extends that to the username,
password and path. The path did not need this handling because its
delimiter from the authority it part of the path.
For example, a URL with no username is one where it's set to QString()
(null). A URL like "http://:kde@kde.org" is understood as an
empty-but-present username, for which toString(RemovePassword) will
return "http://@kde.org", keeping the empty-but-present username.
Change-Id: I2d97a7656f3f1099e3cf400b199e68e4c480d924
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
drawEllipse() and the drawPolygon() overloads are all reimplemented, so there is
no point having this here.
Change-Id: I343cea0dd0fff2ed6a27be2a19459056e929f9d8
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
I can't find any uses of this anywhere, in either Qt 4 or Qt 5.
Change-Id: Ibf747b57b4afdd81e11631e87a80dcab5ac12f69
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
- QFileSystemModel::rmdir() and QFileSystemModel::remove() changed to
non-const -- they don't change the object, but they do change the
file system, and the Qt way is to be non-const if having side-effects
on external entities.
- The comment on incompatibility between entryList and QFileInfo will
not be fixed as doing so is likely to break existing code.
- The comment on removing the internal resolvedSymLinks variable has
been removed, as the variable is still used.
Task-number: QTBUG-25088
Change-Id: I20456e4d116076403d9c4d4692ee05c178a1ed17
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
- change customColor() to return QColor instead of QRgb.
- change setCustomColor() and setStandardColor() to take
a QColor instead of QRgb.
- add missing standardColor() getter method.
Task-number: QTBUG-25087
Change-Id: Ic6adb2031ef47f5e9b15fa3560a5322e6847c0bb
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit addresses a Qt 5 to-do comment in the code. The method was
already protected (so could already be made public by sub-classing),
and already has documentation in qboxlayout.cpp.
Task-number: QTBUG-25098
Change-Id: I5b51d34be8180becb63b8ad291879620f265bbec
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Most of the tests were removed while QUrl::toEncoded or fromEncoded
were deprecated in the development process. Since they aren't
deprecated in the end, bring them back.
Change-Id: Ibdb6cd3c4b83869150724a8e327a03a2cd22580d
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
By having the default value equal to zero, we follow the principle of
least surprise. For example, if we had
url.path()
and we refactored to
url.path(QUrl::DecodeSpaces)
Then instead of ensuring spaces are decoded, we make spaces the only
thing encoded (unicode, delimiters and reserved characters are
encoded).
Besides, modifying the default can only be used to encode something
that wasn't encoded previously, so having the enums as Encode makes
more sense.
As a side-effect, toEncoded() does not support any extra encoding
options.
Change-Id: I2624ec446e65c2d979e9ca2f81bd3db22b00bb13
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This allows things like http://example.com/{1234-5678}?id={abcd-ef01}.
But do not allow it in other parts of the URL. I could allow it in the
fragment, but in the username and password it would be too ugly.
In order to do that, make DecodeReserved use two bits and have
PrettyDecoded set only one of them. That way, toString(PrettyDecoded)
can be distinguished from toString(PrettyDecoded | DecodeReserved),
just as path(PrettyDecoded) can be distinguished from
path(PrettyDecoded & ~DecodeDelimiters).
Also, take the opportunity to avoid decoding the reserved characters
in the query. Keep them encoded as they should be.
Change-Id: I1604a0c8015c6b03dc2fbf49ea9d1dbed96fc186
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
DecodeReserved applies to all characters between 0x21 and 0x7E that
aren't unreserved, a delimiter, or the percent sign itself.
Change-Id: Ie64bddb6b814dfa3bb8380e3aa24de1bb3645a65
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
There's little value in having the DecodeUnambiguousDelimiters option
since neither QUrl nor QUrlQuery can return values that are ambiguous
in that particular context, ever.
This option could be used to encode a character if, when placed
in a URL, it would need to be encoded. Such cases are hash (#) or
question marks (?) in the path component, or slashes (/) and at signs
(@) in the userinfo.
However, we don't need two enums for that, since there are no
other characters that can appear in either form. Still, leave two bits
for this enum. In the future, if we want to split the gen-delims from
the sub-delims, we are able to.
Change-Id: If5416b524680eb67dd4abbe7d072ca0ef7218506
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This tests how QUrl encodes and decodes certain characters and leaves
some other ones alone. It also tests that the output of toString() (in
whichever encoding was being tested) is also parsed again to be
exactly the same as the previously decoded form.
Change-Id: Ie358d001f8b903409db61db48bde1ea679241a60
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This is the same fix as the previous commit did for the other
components of the URL. But we're also changing how we handle the "[]"
characters in a query: previously the handling was like for other
sub-delims; now, they're always decoded, assuming that the RFC had a
mistake and they were meant to be decoded.
Change-Id: If4b1c3df8f341cb114f2cc4860de22f8bf0be743
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Refactor the way that QUrl stores and returns the components of the
URL so that ambiguous delimiters (gen-delims that could change the
meaning of the parsing) are interpreted correctly. Previously, QUrl
called "unambiguous" the form found in a full URL, even though each
item in isolation could have more characters decoded.
Now, instead, store only the fully decoded form. To recreate the
compound forms (the full URL, as well as the user info and the
authority), we need to do more processing.
This commit applies to the user name, password, path and fragment
only. The scheme, host and port do not need this work because they are
special; the query is handled separately.
Change-Id: I5907ba9b8fe048fff23c128be95668c22820663a
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
When errors are detected synchronously in _q_startOperation,
they were not reported. This is because unlike the generic
QNetworkReplyImpl the function is called directly rather than
using a queued connection.
In order to report errors, use the _q_error and _q_finished slots
so that signals are emitted after returning to the event loop
i.e. after the application had a chance to connect the QNetworkReply
Change-Id: I8a7bbe79a934f4634fb4e0572ebb5479dfc5f489
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
Change-Id: I7d8ea41299408377042a9f0d0a672e1a6fb57e7d
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
If background requests are not allowed, don't even attempt to start
the network session, just fail the request immediately.
After this change, a QNAM with mixed requests queued should behave
as follows when background requests are disabled:
- background requests at head of the queue fail
- first foreground request starts the session and succeeds
- remaining background requests fail
- remaining foreground requests succeed
If policy is changed on the fly, then running background requests
are not aborted. However queued background requests won't be started.
Change-Id: Ic9aba1eb59ca41b166a08d2ed09418e1b6af6b60
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
This allows the system to publish usage restrictions to applications
related to the network in use.
Currently there is only one restriction defined:
NoBackgroundTrafficPolicy, which means that non user initiated traffic
should be avoided (e.g. background downloads).
For example this policy could be applied to save battery or data transfer
charges.
Change-Id: I49e26c0f3650d2b92f4ec51981aae9435b717b49
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Switched the error code.
Republish the error string from the bearer plugin if possible.
Change-Id: I9e4ac7a9914fbf2e87fe8fd3a5175deda6d933d2
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
This error will be used when background network requests are not allowed
according to the current policy of the bearer plugin.
For example, to save power when battery is low on a portable device.
Change-Id: I866e115f8fdd046134da99ea895b7c1df0375f26
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
This is to replace the UnknownNetworkError which occurs when the
internal QNetworkSession fails to start (e.g. no usable WLAN available)
Change-Id: I2b14577c22e0acf8ff07be7e932f0dfe9ac89c33
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
Set the QNetworkSession attribute to match the QNetworkRequest that
triggered it.
Currently if there are a mix of normal and background requests queued
and background connections are not allowed by policy:
- background requests at the head of the queue should fail
- first foreground request should successfully start a connection
- remaining requests succeed regardless of background attribute
Change-Id: If0e3ec0b8a5096e3d7cd6df85884c6f53172d233
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
This is so that the ConnectInBackground flag can be set on the
QNetworkSession internal to QNAM according to pending requests.
Change-Id: If0cc62f5117ed8febbbda7b7f6de62b11b274258
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
Who can say why it was put in QPaintEngineEx's header, but it certainly doesn't
belong there.
Change-Id: Ieb3b977affcf4b240f621d13b72bdc0e8f8138b9
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these
functions just to avoid an include, except to pay for it with worse runtime
performance.
On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15%
faster(!) than adding an additional call to qMemSet. The advantage on sizes
above that is unmeasurable.
For qMemCopy, the benefits are a little more modest: 16-7%.
Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: John Brooks <john.brooks@dereferenced.net>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
The parameter represents an allocation size and unsigned matches the
Q*Data::alloc member it ultimately represents (even if they currently
differ in accounting for the null).
There's still work up for grabs to ensure we avoid integer overflows
when growing.
Change-Id: Ib092fec37ec2ceed37bebfdc52e2de27b336328f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Some FTP implementations (currently not including QNAM) strip the first
slash off the path in an FTP URL so that the path in the URL is relative
to the login path (the user's home directory). To reach the root
directory, another slash is necessary, hence the double slash.
In anticipation of future URL normalisation, which Qt 4 could do, "//"
could be rendered to "/", so this extra slash should be "%2F".
This operation is done only in QUrl::fromUserInput.
Change-Id: If9619ef6b546a3f4026cb26b74a7a5a865123609
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Without those early-clobbers, the compiler might decide to schedule a
register that is also used as output. The existing early clobber in
the tmp variable was there so the compiler wouldn't use a register
scheduled as input (especially EAX).
To be honest, I'm not convinced that the compiler should be allowed to
do this. That means that two output variables are scheduled to the
same register... still, this fixes a problem found with GCC 4.2 (at
least the Mac one).
Change-Id: I6cd4676284e9a83d6aac4b439c6e58e347c40106
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
It's better to fail at linking time than to try and figure out later why
QPluginLoader refuses to load the plugin.
Change-Id: I439bad9dcdbfff9f76efe40381fd7ccfffe738bc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Donald Carr <donald.carr@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Also removed a define which was used only for this purpose.
This change brings the constructors in line with Q{Core,Gui}Application.
Change-Id: I1134ca5611453e8445c1a4f3226846621fa8872c
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Port of Robin's work from I0a53aa4581e25b351b9cb5033415b5163d05fe71
on top of the new qHash patches (the original commit just introduced
lots of conflicts, so I redid it from scratch).
This is based on the work done in the QHash benchmark over the past
few months experimenting with the performance of the string hashing
algorithm used by Java.
The Java algorithm, in turn, appears to have been based off a
variant of djb's work at http://cr.yp.to/cdb/cdb.txt.
This commit provides a performance boost of ~12-33% on the
QHash benchmark.
Unfortunately, the rcc test depends on QHash ordering.
Randomizing QHash or changing qHash will cause the test to fail
(see QTBUG-25078), so for now the testdata is changed as well.
Done-with: Robin Burchell
Change-Id: Ie05d8e21588d1b2d4bd555ef254e1eb101864b75
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
The implementation of the various qHash overloads offered by
Qt can change at any time for any reason
(speed, quality, security, ...).
Therefore, relying on the fact that qHash will always give
an identical result across Qt versions (... across different
processes, etc.), given identical input, is wrong.
Note that this also implies that one cannot rely on QHash
having a stable ordering (even without the random qHash seed).
For such use cases, one must use f.i. a private hash function
that will never change outside his own control.
This patch adds a private hash function for QStrings,
which is identical to the Qt(4) qHash(QString) implementation.
A couple of spots in Qt where the results of a qHash call were
actually saved on disk are ported to use the new function,
and a bit of documentation is added to QHash docs.
Change-Id: Ia3731ea26ac68649b535b95e9f36fbec3df693c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Avoid the conversion to a temporary QString -- just hash the address
as a byte array.
Change-Id: Ic35cdbbc3ee66c32a28d911bd27de0092395979f
Done-with: Shane Kearns
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
An unnecessary #include <QHash> was also removed, and other
includes refactored.
Change-Id: Ifcd3e37d75029c142a2e55ab492b88624505670a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When sorting a model recursively, the children of a QFileSystemNode
are extracted from their parent in a QHash order; then filtered,
then sorted (using a stable sort) depending on the sorting column.
This means that the order of the children comparing to equal for
the chosen sort are shown in the order they were picked from the
iteration on the QHash, which isn't reliable at all.
Moreover, the criteria used in QFileSystemModelSorter for sorting
are too loose: when sorting by any column but the name, if the result
is "equality", then the file names should be used to determine
the sort order.
This patch removes the stable sort in favour of a full sort,
and fixes the criteria of soring inside QFileSystemModelSorter.
Change-Id: Idd9aece22f2ebbe77ec40d372b43cde4c200ff38
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Same as with QtCore, remove the #ifdef and #ifndef and select the side
with STL.
Change-Id: If1440080328c7c51afe35f5944a19dafc4761ee5
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
QT_NO_STL is now no longer defined, so remove the conditionals and
select the STL side.
Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
This pertubates the results of the calls to the one-argument
version of qHash through the catch-all template.
Change-Id: I7037b25d545e6f1360384a83ff895f4bb62ed195
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Two equal QByteArrays must return the same hash.
Change-Id: Iddd45b0c420213ca2b82bbcb164367acb6104ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>