The x11 native painting experimental feature requires fontconfig to
build, so add that dependency to configure.
Task-number: QTBUG-62121
Change-Id: Iac79c17fdeaef06b2e075dc34fe554c0e7c56edf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QFile::copy was assuming that the target file was native and therefore
it could simply take the file descriptor to clone. While that was not
currently a problem, in theory it could be as we do have one writeable
file engine besides QFSFileEngine (QWinRTFileEngine).
By refactoring to take the parameter as a QAbstractFileEngine, we can
ensure that the target file is a native file.
Change-Id: Ib7a1737987bf4c4a8c51fffd14d0c048fd509025
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
That code was added by ae5f2a6672 and
later incompletely removed by c173a50719.
This patch amends c173a50719.
Change-Id: Ibfd39aaf9b49424fc54d878dc588454eb841ed97
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
On BSD systems (tested on macOS and FreeBSD), you *can* lseek(2) or
ftell(3) on a pipe and get its current position. But QFile will not get
the position when the file is sequential, so we need to return 0.
Technically speaking, we ought to do the same for block devices, but if
you're redirecting stdin, stdout or stderr in the unit test to or from a
block device, you deserve the extra work to add that yourself to the
test.
Change-Id: I3868166e5efc45538544fffd14d8a74e92963fe7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
The stat::st_flags and fchflags(2) syscall are marked:
HISTORY
The chflags() and fchflags functions first appeared in 4.4BSD.
Change-Id: I81480fdb578d4d43b3fcfffd14d4fd23bd27e37e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias C. Berner <tcberner@FreeBSD.org>
If a QFileInfo was constructed with an empty path, which could happen
with QFileInfo(QFile()) or via QDir, etc., then it would issue system
calls to empty paths and could even produce warnings. This commit makes
am empty path name be the same as a default-constructed QFileInfo and
corrects the use if 0 for ownerId and groupId to match the
documentation.
[ChangeLog][Important Behavior Changes] QFileInfo on empty strings now
behaves like the default-constructed QFileInfo. Notably, path() will now
be the empty string too, instead of ".", which means absoluteFilePath()
is no longer the current working directory.
Change-Id: I8d96dea9955d4c749b99fffd14ce34968b1d9bbf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This system call, new in Linux 4.11, gives us the file birth time. It's
also extensible, representing the fourth generation of stat(2) on Linux
(the original sys_stat(), sys_newstat(), sys_stat64() and now
sys_statx()), not to be confused with glibc's __xstat function, which
wraps a call to stat64. Anyway, the new one is designed to be extensible.
Now we get birth times on ext[34] on Linux too:
Name: .
Path: . (/home/tjmaciei/src/qt)
Size: 4096 Type: Directory
Attrs: readable writable executable hidden nativepath
Mode: drwxr-xr-x
Owner: tjmaciei (1000) Group: users (100)
Access: 2017-07-02T14:47:49.608
Birth: 2016-05-02T13:20:33.097
Change: 2017-07-01T13:37:08.737
Modified: 2017-07-01T13:37:08.737
It's not supported in any other filesystems I have (Linux sources show
xfs has the feature too). Even on ext4, it depends on whether the
filesystem was created with 256-byte inodes, which my /boot fs wasn't.
Change-Id: I8d96dea9955d4c749b99fffd14cda23ed60d5e72
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This fixes an issue where iOS, watchOS, and tvOS versions would be
mis-detected as 100 times their version (i.e. iOS 8.0 as iOS 800.0).
Instead of protecting the branch in (version >= 100000) with a macOS
ifdef, we can simply remove it entirely since Qt cannot be run on OSes
where the old encoding was used (macOS < 10.10).
Amends 8418a6335b
Change-Id: I32b307163c815799cb46c008b93f3b53d27c48b9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This will allow Qt Quick applications to use the integrated GPU on
compatible Apple hardware, which helps preserve battery life.
Change-Id: I9224bd408930e2ed3dd8a022432512e78d69c195
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This makes editing the templates easier since they can be read
alphabetically.
Change-Id: I6af5e4f13718ba1145c2dec1f8a05bc600ea937a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Conflicts:
src/widgets/kernel/qwidget.cpp
This merge also extends the expected output of the pairdiagnostics
teamcity output (added in dev in commit
c608ffc56a) after the recent addition of
the flowId attribute to the teamcity output (commit
8f03656211 in 5.9).
Change-Id: I3868166e5efc45538544fffd14d8aba438f9173c
The test verifies that a cookie with a date in the future is not
"expired" and will be sent to the server. This test started failing
on August 7th 2017 when the test case "0003" with it's cookie expiring
August 7th 2017 started ... expiring ;-)
Bumped all suspicious cookie test cases by a hundred years.
Change-Id: I7c09069ec4999e2ea0aae7b2a2819cced0fd6a99
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
The blacklisting is not needed anymore as we now use -qt-harfbuzz.
This reverts commit b36e5faad4.
Task-number: QTQAINFRA-1363
Change-Id: I3ae50588204b27e6880416ae2cbc28dda53bb292
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
It was working on Linux because _GNU_SOURCE gets us POSIX.1-2008
compatibility, but not on macOS or the BSDs. There, we were still stuck
to full second precision.
This commit uses the template trick introduced by the futimes code
(which itself was inspired by commit 2fb42eb4af
in QtNetwork). Also note how it adds support for birth time, if the
system's stat struct has that information.
Tested to work on MacOS and FreeBSD. The manual filetest produces:
Name: .
Path: . (/usr/home/tjmaciei/src/qt/qt5)
Size: 1536 Type: Directory
Attrs: readable writable executable hidden nativepath
Mode: drwxr-xr-x
Owner: tjmaciei (1001) Group: tjmaciei (1001)
Access: 2017-07-13T20:03:47.916
Birth: 2017-07-13T20:03:47.916
Change: 2017-07-13T20:04:41.648
Modified: 2017-07-13T20:04:41.648
Linux will require support for statx(2).
Change-Id: I8d96dea9955d4c749b99fffd14cd97d7a8c6d45d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Took me a long while to understand what it did. Now that I do, I can
also answer the question left behind during the original implementation
in Qt 4.8 (commit 4fd2aced96d9095254d89f9da9c911bd88f15245 in the old
history): how to know if a file exists?
Change-Id: I8d96dea9955d4c749b99fffd14cdae135499a0d3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
qimage.cpp:2127: warning: Can't link to 'isDetached()'
Change-Id: Ib8f056441bf08e315ed97caf55c510f50ebaf4ed
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
In Qt, we have QTextOption::tabStop, QTextEdit::tabStopWidth and
QPlainTextEdit::tabStopWidth.
Neither are very good names, since the tab stop is neither a
numerical value as in the former, nor does it have any dimensions
that can be measured, as in the latter. Vertical text advances
may also be supported by Qt at some point in the future, at
which point the name would make even less sense.
At the same time, we expose the actual type of the tab stop
distance as floating point in the QTextEdit and QPlainTextEdit
API instead of always rounding it to an int.
To avoid duplicating either of these APIs in Qt Quick, we
introduce tabStopDistance as the common term instead and deprecate
the old names.
[ChangeLog][Text] Introduced tabStopDistance property in
QTextOption, QTextEdit and QPlainTextEdit as replacement for
the inconsistently named tabStop and tabStopWidth properties.
QTextOption::tabStop, QTextEdit::tabStopWidth and
QPlainTextEdit::tabStopWidth have subsequently been deprecated.
Change-Id: Ib7e01387910cddb58adaaaadcd56c0e69edc4bc2
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This patch updates the code from the unix implementation of
QStandardPaths to use QRegularExpression in place of the deprecated
QRegExp.
Change-Id: I51fa231dcd70ca55d1bfffb31d8f28f964ac44fe
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
The full documentation explains it well but a more prominent warning
will help avoid the wrong use of that class and encourage user to read
further the documentation.
Change-Id: I3178749f2b1b0350040f81eef253fd85c7ba0a5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The use as in the code:
futimesat(fd, NULL, &tv)
is not documented to work. The file descriptor should be a directory's
one, not an open file (though the Linux source code seems to handle that
case). This call was done as a fallback to futimes, so it's very
unlikely a system would have futimesat and not futimes.
Both the Linux and the FreeBSD man pages say it's deprecated anyway.
Change-Id: I8d96dea9955d4c749b99fffd14cd94068dc7668a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The Unix stat fields "st_ctime" and "st_ctim" mean "change time", the
last time that the file/inode status fields were changed. It does not
mean "creation time". So this commit splits all of the internal API to
"birth" and "metadata change" instead of "creation" to avoid the
conflict.
Change-Id: I149e0540c00745fe8119fffd1463fe78b619649e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
[ChangeLog][QtCore][QFileInfo] Deprecated created() because it could
return one of three different file times depending on the OS and
filesystem type, without the ability to determine which one is which. It
is replaced by metadataChangeTime() and birthTime().
[ChangeLog][QtCore][QFileInfo] Added QFileInfo::metadataChangeTime(),
which returns the time the file's metadata was last changed, if it is
known, and falling back to the same value as lastModified() otherwise.
On Unix systems, this corresponds to the file's ctime.
[ChangeLog][QtCore][QFileInfo] Added QFileInfo::birthTime(), which
returns the file's birth time if it is known, an invalid QDateTime
otherwise. This function is supported on Windows and on some Unix
systems.
Change-Id: I0031aa609e714ae983c3fffd1467bd8b3e3a593d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Added flowId='name' to each message when using TeamCity logging format.
This is necessary to distinguish separate processes running in parallel.
[ChangeLog][QtTest] Added flowId to messages when logging in TeamCity
format. FlowId is used to distinguish logging from multiple processes
running in parallel.
Change-Id: I7f5046c1058ff02770404caa2c9b3a5398f97f6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Building iOS shared failed with link errors to the CoreGraphics framework
when building without harfbuzz-ng.
This patch adds the missing dependency.
Change-Id: If464417039172c2854e455563153057f0cea2a22
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Commit 32a94e54 changed the API of the QPS engine (PaintCommands
class). Update the usage accordingly.
Change-Id: Ide57609e636dad0aa434d1049b600b72f731bc30
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Code was lagging a bit behind published standards.
Change-Id: I0fe07c0162a54d9eed8b539887496b9313b37aa4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
The current code fetches currentOwner in the constructor, then sets up
a connection between a service watcher and _q_serviceOwnerChanged() in
initOwnerTracking(). But an owner change notification could arrive
after we fetch the current owner and before the connection is made.
In this case the owner change notification will be lost, and the
interface will keep reporting being invalid permanently.
The fix is to delay initializing currentOwner until after the connection
is made.
Task-number: QTBUG-62284
Change-Id: I92b9d61004e14fd2ee2543488740a542dc7a9b7a
Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The file was added to glibc 2.7 along with the functions we need (Added
2007-10-05). But they forgot to install the file until a month and a
half later (2007-11-17), which means it missed the 2.7 release
(2007-10-19).
Note that EFD_CLOEXEC wasn't added until glibc 2.9, so effectively glibc
2.9 is required.
Change-Id: I3868166e5efc45538544fffd14d773ba576fb793
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Several of these variables/macros are no longer defined. We didn't
validate the preconditions on iOS, tvOS, or watchOS, so no
need to bother validating them on macOS either. Nor did we check the
OSStatus result on any platform anyways.
Task-number: QTBUG-62266
Change-Id: Id19ebead5d3a8a08a0a56d798f0173d0d893fc91
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
The renameat2(2) Linux system call, new in 3.16, allows for the atomic
renaming of a file if and only if it won't clobber an existing
file. None of the Linux libcs have enabled this syscall as an API, so we
use syscall(3) to place the call.
If your libc has SYS_renameat2 but your kernel doesn't support it, we'll
keep issuing the unknown syscall, every time. Users in that situation
should upgrade (3.16 is from 2014).
On Darwin, there's a similar renameatx_np (guessing "np" stands for
"non-portable"). I haven't found anything similar on the other BSDs.
Change-Id: I1eba2b016de74620bfc8fffd14ccb4e455a3ec9e
Reviewed-by: David Faure <david.faure@kdab.com>
This is required so that one can use QSettings in situations that
temporary files or renaming may not work.
[ChangeLog][QtCore][QSettings] Added setAtomicSyncRequired(), which
allows one to use QSettings with config files in unwriteable directories
or in Alternate Data Streams on NTFS on Windows. This used to work
before Qt 5.4, but remains a non-default behavior due to the potential
of data corruption.
Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4f77112f0402f
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
We can't use MoveFile to do atomic commits on an ADS, so QSaveFile needs
to detect when the target name is ADS and then use the direct fallback
mode.
[ChangeLog][QtCore][QSaveFile] Saving to Alternate Data Streams on NTFS
on Windows is now possible, but requires setDirectWriteFallback(true).
Task-number: QTBUG-47379
Change-Id: I81480fdb578d4d43b3fcfffd14d4bc062ae1750d
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
First, instead of getting 32 bits of random for every character, we can
get reasonable randomness with just 10 bits, so we can replace 3
characters per get32() call. A typical template with six X will only
need 64 bits of random data.
Second, using the PID is not random at all. The reason why mktemp used
to use it is irrelevant (probably because applications failed to seed
rand()). Either way, we don't need nor want the PID anymore. And because
the code is completely rewritten, the UCB copyright no longer applies.
Change-Id: I84e45059a888497fb55ffffd14d2d4cfe159abca
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This means the workaround for Linux's behavior now works even if
QTemporaryFile is disabled. We also avoid the creation of an otherwise
unused temporary file just so we can take its name.
Tested with tests/manual/filetest. Strace shows:
renameat2(AT_FDCWD, "a", AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.EBG705", RENAME_NOREPLACE) = 0
renameat2(AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.EBG705", AT_FDCWD, "A", RENAME_NOREPLACE) = 0
Before it was:
open("/var/run/media/tjmaciei/B852-6088/a.VuL412", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
lseek(4, 0, SEEK_SET) = 0
rename("a", "/var/run/media/tjmaciei/B852-6088/a.VuL412") = 0
stat("A", 0x7fff13260f00) = -1 ENOENT (No such file or directory)
close(4) = 0
renameat2(AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.VuL412", AT_FDCWD, "A", RENAME_NOREPLACE) = 0
(the absolute path comes from fd61059d35
and it seems it was needed for Symbian)
Change-Id: I1eba2b016de74620bfc8fffd14ccc7c4ded009c8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
So we can use it in QTemporaryFile, QTemporaryDir and QFile::rename()
[ChangeLog][QtCore][QTemporaryDir] The class now supports the "XXXXXX"
replacement token anywhere in the template, not just at the end. This
behavior is similar to what QTemporaryFile supports.
Change-Id: I1eba2b016de74620bfc8fffd14ccb645729de170
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This makes the code more reusable by the unnamed file feature.
This commit removes the backwards compatibility in using sequential file
names if the first one failed. Since 5483b30868,
there are at least three random characters, so the chance of collision
is 1 in 52³ = 140608.
That commit also did not take a system failure into account. If we ended
up getting EEXIST for all attempts, we'd attempt on average 26³*53³ file
creations. For that reason, I've added an upper limit in the number of
attempts to create a file.
Change-Id: I1eba2b016de74620bfc8fffd14cc7e31c6e50558
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Instead of storing it in d->fileEntry. The QFSFileEngine methods may try
to use it before the file entry is filled with the actual file name and
that's no good. This change is using a reference to avoid keeping an
extra QString reference and to avoid going out of sync.
Change-Id: I1eba2b016de74620bfc8fffd14cca9e340e4b1e2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Calling the parent version is still ok, but if you call the new one you
get a bit of benefit. Since we control the file name, we don't have to
worry about a case-changing renaming (by choice). We also know that the
file is a regular one, because we created it.
[ChangeLog][Important Behavior Changes][QTemporaryFile] rename() no
longer attempts to do block copying, as that usually indicates a mistake
in the user's code. Instead, either create the temporary file in the
same directory as the new name to be, or use QSaveFile.
Change-Id: I1eba2b016de74620bfc8fffd14ccaac0cdb9fe87
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The rename(2) system call overwrites, so instead of using it, we try to
use the link/unlink pair. This works for regular cases, but can fail if
trying to change case in case-insensitive filesystems, if we're
operating on a non-Unix filesystem (FAT) or, on Linux, if the file
doesn't belong to the calling user (BSDs permit this). For those cases,
we fall back to rename(2).
That means there's a race condition if a new file is created there. But
we at least reduce the likelihood of that happening for regular files.
Change-Id: I1eba2b016de74620bfc8fffd14ccb38fd929e5aa
Reviewed-by: David Faure <david.faure@kdab.com>
In the Android style, we matched both the full CE_PushButton,
and the individual, decomposed CE_PushButtonBevel and
CE_PushButtonLabel (and similar for other controls) to the
same drawing code which draws both the label and the bevel.
When used together with the style sheet style, this caused
the label of the button to be drawn multiple times in
different locations.
For labels, we now skip the part which draws the actual control,
and for the non-textual parts of the controls, we skip drawing
the label.
[ChangeLog][QtWidgets][Android] Fixed label duplication for
buttons when using style sheets with the Android style.
Task-number: QTBUG-48639
Change-Id: I1a1cdb0a82870cebd0438c5c72199afc3192938c
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
A nullptr QVariant should become a null QString or QByteArray,
since null strings have previous in our APIs represented the null value
in the absence of a dedicated null metatype.
Change-Id: I3b8f6386ece314d7c196959fbcf042c4fe0508a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Based on a test-case from Israel Lins Albuquerque, that my planned
fixes to our parsing of ISODate date-times would break.
Change-Id: I5658df9c7daed59d43aa5574df25d4d9eac4677d
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Actually check that there's a T where ISO 8601 wants it (instead of
just skipping over whatever's there), with something after it; move
some declarations later; add some comments; and use the QStringRef API
more cleanly (so that it's easier to see what's going on). Simplify a
loop condition to avoid the need for a post-loop fix-up.
This incidentally prevents an assertion failure (which brought the
mess to my attention) parsing a short string as an ISO date-time; if
there's a T with nothing after it, we won't try to read at index -1 in
the following text. (The actual fail seen had a Z where the T should
have been, with nothing after it.)
Add tests for invalid ISOdate cases that triggered the assertion.
Change-Id: Ided9adf62a56d98f144bdf91b40f918e22bd82cd
Reviewed-by: Israel Lins Albuquerque <israelins85@yahoo.com.br>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I was mistaken before, the "es" part for that version isn't optional, it
*must* be omitted.
Change-Id: I9e83d2317523fb0a905e40b95a56033cf693b93b
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Changes the QVariant::isNull() implementation for
pointer types so they return true if null.
[ChangeLog][QVariant] QVariants containing pointers will now return
true on isNull() if the contained pointer is null.
Change-Id: I8aa0dab482403837073fb2f376a46126cc3bc6b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>