These tests skip when we're writing to a btrfs filesystem because, for
some reason, the amount of free space does not update synchronously with
file writing. But instead of giving up if $TMPDIR is a btrfs, let's try
and use the $XDG_RUNTIME_DIR, which is usually a tmpfs.
This will work in the CI for the openSUSE set ups, where / is btrfs,
/tmp is not a separate tmpfs, but /run/user/1000 is available.
FAIL! : tst_QStorageInfo::tempFile() The computed value is expected to be different from the baseline, but is not
Computed (free) : 25510780928
Baseline (storage2.bytesFree()): 25510780928
Loc: [tst_qstorageinfo.cpp(234)]
Pick-to: 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d7af1c67ec988
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Previously, it was left to the caller to guess.
Change-Id: Icc22b8c874046de78e16253cf0cc3ba2f334362b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Pick-to: 6.5 6.6
Change-Id: I8753b8793c744d4fe2cae8d7293abf6961c60601
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The tooltip text doesn't show with right palette when application runs
in dark mode using gtk3 theme.
This patchset removes explicitly setting ToolTipText palette in
gtk3theme.
Pick-to: 6.6 6.5
Change-Id: Id90626a377733814c3f32f0bf7e5539097b76dd6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
QNetworkAccessManager may fail to finish with Windows apps that are
running with low integrity level sandboxing.
The root cause is that such applications are not allowed to open ROOT
system certificate store with write privileges. This causes the
CertOpenSystemStore helper function to fail, because it attempts to open
certificate stores with the option of adding or deleting certificates.
We only use the CertOpenSystemStore with the intent of fetching
certificates from the certificate store, so we do not need write access.
The fix for this issue is threfor to open the system certificate store
as read-only by using the lower-level CertOpenStore function.
The CERT_SYSTEM_STORE_CURRENT_USER flag is provided to CertOpenStore to
keep the documented behavior of CertOpenSystemStore, which states "Only
current user certificates are accessible using this method, not the
local machine store."
Fixes: QTBUG-118192
Pick-to: 6.5 6.6
Change-Id: I529b760398f84137a0e95c8088a71b293d302b54
Reviewed-by: Fredrik Orderud <forderud@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Documentation for the other functions refer to seat(), but that itself
isn't documented
Pick-to: 6.6
Change-Id: I9a628e87153b687b2fa444798de1af74e6251eee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
To allow building and developing from Android Studio and get rid of
warnings.
Change-Id: I5f896a270917120f98eefd2f4aa449714451f994
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This check for error code is never reached, the error code is
always set to 0 in startApp() and then check for in loadApplication()
while the latter method is only called by
startApp().
Task-number: QTBUG-114593
Task-number: QTBUG-115016
Change-Id: I762009d76567cc1d090fe29048c35220d433dd1d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
The variable m_optionsMenuIsVisible is assigned but never
used.
Task-number: QTBUG-114593
Change-Id: Ie4b61b37f2bc05d8d2a348dcad7487eb8fa1ac00
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Clean the long lines on the code, extract into smaller methods where
appropriate, and some small naming or logic clarifications. Some of the
deeper code might use some simplification but that's for another patch
with better debugging to avoid potential regressions.
Task-number: QTBUG-118077
Task-number: QTBUG-114593
Change-Id: I8964b87727819b4846c51f5fa5febfa8caae4f8d
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
To further simplify the code and logic of the delegate, move keyboard
input code to separate class. Make an input delegate available under the
QtActivityDelegate to allow classes like QtNative and the Activity to
access that. For now, it's okay to leave access from QtNative to that,
but for future even that should be simplified and the Activity should be
accessing that directly.
For the case where the QtInputDelegate needs access to
QtActivityDelegate, for now namely updateFullScreen(), a new Listener
is implemented to be implemented under QtActivityDelegate.
Along the way use newer JNI APIs under C++ QtAndroidInput.
Don't make them static methods, so that it can be possible later to
do various keyboard operations to specific activity and not a global
one.
Task-number: QTBUG-114593
Task-number: QTBUG-118077
Change-Id: I110b897f6f16d0ae5f5a645551b4a82e8ad3f2fb
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
If a QJniObject method that uses the stored JNIEnv pointer is called
from a different thread than the one the object was created in, then a
FATAL abort of the JNI runtime is likely, but hard to debug (the error
messages from JNI are visible in the logcat log of adb).
In debug mode, compare the stored JNIEnv pointer with the one provided
for the current thread, and emit a critical runtime warning if they do
not match, as this indicates a race condition to the underlying JAVA
object.
Change-Id: Ief578f445bcfab1939ddbe95c6ba796279be9115
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Almost all operations on a QJniObject require a QJniEnvironment,
including the construction and destruction of a QJniObject. Instead of
instantiating a temporary QJniEnvironment object in each call, store the
one from the constructor in the private, and reuse it.
Pass the stored environment through to other functions needing it, and
add a checkAndClearExceptions() wrapper.
Static class members still need their own QJniEnvironment, but we can
reuse the one we have to get both jclass and jmethodID rather than
creating new QJniEnvironments in several wrappers.
As a drive-by, clean up nullptr usage in the test that failed when
shortcutting isSameObject for the trivial cases.
Change-Id: Ibadbd2be8a0ec9ab62daf285608ee7fe0a3c8852
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Our signature mapping treats both e.g. bool and jboolean as "Z", and it
is allowed to pass a bool variable as an argument to a function expecting
a jboolean. Except for fields and callMethod return values, where we only
allowed the JNI primitive types.
Fix this by comparing the signatures and size of the type we have with
the JNI types that there are explicit functions for. Cast from and to
the JNI type in both directions to address narrowing (e.g. jboolean is an
unsigned char and converting to bool would be narrowing, even though
both are 8bit types).
This way we can get boolean fields using getField<bool>, and int fields
using getField<int> etc.
Change-Id: I2f1ba855ee01423e79ba999dfb9d86f4b98b1402
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
While we can probably deprecate this function, with the change of
Q_DECLARE_JNI_CLASS'ed types to be QJniObjects we need to correctly
translate from e.g. jobject to QJniObject.
Amends 62cb5589b3.
Change-Id: Id3c23fc0724e2eff895029b694d418481abcb8e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Since QWasmIDBSettingsPrivate is only supported on JSPI now, there is
no need to maintain the isReadReady flag anymore. This lets us simplify
the class a lot.
Change-Id: I67322389463af13b5110091a4f8433f08da19925
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The header uses QPointer in-name-only, so it doesn't need to include
the class' header file. A forward-declaration suffices.
[ChangeLog][Potentially Source-Incompatible Changes] The headers
qevent.h and qfuture.h no longer include the header qpointer.h.
Change-Id: I8d3c3b56f5928a0745a523abf5df3b8106dc15ee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Change the heuristic only to use the stored compiler if we
are building qt itself, like with qt-cmake-private
/ qt-configure-module. qt-cmake is also used by end-users,
where the heuristic to change the compiler default base on
paths is surprising, and can go wrong.
Fixes: QTBUG-108323
Pick-to: 6.6
Change-Id: I0274e470f214a84711013d77068551f9097f4685
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
pkgconf is an alternative implementation of pkg-config, and it is mostly
compatible with pkg-config, but in the case of HarfBuzz, it adds the
`/usr/local/include` to `INTERFACE_INCLUDE_DIRECTORIES` when reports the
include path, and if the path doesn't exist, the configuration fails.
In the case of HarfBuzz, we do some extra work to make sure that we can
always find the library, so, with a bit of modification, we can skip the
faulty pkgconf intervention and create the correct imported target.
Fixes: QTBUG-117905
Change-Id: Id628e4434633534b0d7bfad9e819a8c05da4944d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Simplify addIconFiles() by passing an initializer list instead an
c-array + size
Task-number: QTBUG-118122
Change-Id: Id54bbe8436a9106e59b6fede81e31c3065623b4d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Dont't checks before call QCursorData::initialize().
The inside of QCursorData::initialize() already checks initialized.
Change-Id: I4b34218132df9decf7d04dcc31e873daf300ffe6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Instead of a sequential and thus predictable counter. This improves the
performance of when you keep creating and trashing the same file base
name. The previous algorithm would try all occurrences from 0 to however
many trashings have happened.
This could have been any random number, but the source file's inode is
"random" enough for us.
strace of the second file's trashing:
openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/info/tst_qfile.moveToTrashOpenFile.vLwfNe.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = -1 EEXIST (File exists)
newfstatat(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.vLwfNe", {st_mode=S_IFREG|0644, st_size=16, ...}, 0) = 0
openat(AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/info/tst_qfile.moveToTrashOpenFile.vLwfNe-23527891.trashinfo", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 4
newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644, st_size=2852, ...}, 0) = 0
write(4, "[Trash Info]\nPath=/home/tjmaciei"..., 103) = 103
renameat2(AT_FDCWD, "/home/tjmaciei/tst_qfile.moveToTrashOpenFile.vLwfNe", AT_FDCWD, "/home/tjmaciei/.qttest/share/Trash/files/tst_qfile.moveToTrashOpenFile.vLwfNe-23527891", RENAME_NOREPLACE) = 0
close(4) = 0
Change-Id: I9d43e5b91eb142d6945cfffd1786d73459c2eb3d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
So we can more easily get any errors from attempting to write the file.
It is possible to get them with QFile, by either doing .flush() or using
QIODevice::Unbuffered, but using the C API is a definite sure way. Plus,
since this is QFileSystemEngine, this avoids the possibility that QFile
may choose to use a different file engine than the native one, for some
reason. And it reduces overhead.
This allows us to more easily detect why the file creation failed and
therefore stop looping if the error wasn't EEXIST. That will avoid an
infinite loop in case the necessary directories exist but aren't
writable.
It's also moved above the renaming, such that the failure to populate
the info file prevents the renaming too. Both operations can have the
same likely errors, ENOSPC and EIO. The likelihood of EIO is very low,
for both; but for ENOSPC it's far more likely for writing the
file. Avoiding the ENOSPC error for the renaming is handled in a later
commit.
Change-Id: I9d43e5b91eb142d6945cfffd1786d417142ac728
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
QStorageInfo is great, but rather expensive, so this introduces a faster
check by stat()ing the source file and $HOME, to see if they are the
same device, saving us two or three QStorageInfo constructions. That is
a necessary condition: if they aren't the same device, we know rename()
into $HOME/.local/share/Trash will fail.
But it's not a sufficient condition: they need to be the same mount
point and that's something only QStorageInfo will give us. Strictly
speaking, the only way to be sure that you can rename() into the trash
path is to, well, attempt it (as usual, something for a later commit).
Change-Id: I9d43e5b91eb142d6945cfffd1786c474cac25083
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This is not a security issue because we still use QIODevice::NewOnly
(O_EXCL) and loop again. But because we do so, we don't need to check
for existence with QFile::exists() in the first place.
Pick-to: 6.6
Change-Id: I9d43e5b91eb142d6945cfffd1786c98a39781517
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Make it receive the QSystemError so it can set the error condition
properly in case the suitable location for this input file can't be
found. This also includes the case when the input file does not exist in
the first place, which I moved into the function because upcoming
commits will imply this check anyway.
Change-Id: I9d43e5b91eb142d6945cfffd1786c6e59d3b0204
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The m_children container isn't used at all, so remove it. Spotted by
Volker Hilsheimer.
Change-Id: I79db1f77c0e4caf8ebab1573a82e07396a6a806b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Instead, check the macro that we're about to use. This is also done in
qprocess_unix.cpp
Pick-to: 6.5 6.6
Change-Id: I8f3ce163ccc5408cac39fffd178d657b7594d07a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Extract the information about the relation between invalid and valid
datetimes into a snippet, and include it in the documentation of
every relational operator.
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I61b239647efe928eb0758cfc5649b33ab4d06c7d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We need to re-apply the application badge when the color scheme changes;
when a task bar button is being created for the fist time; or after Explorer
has crashed and re-started.
But we should only do that if the user has set an application badge
via our APIs. Otherwise we might end up clearing an existing badge
that was set via the native APIs directly.
Fixes: QTBUG-118117
Pick-to: 6.5 6.6
Change-Id: I1f1fecba44c118d4e3f7ef4119139c3ebd23f047
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
The SWP_NOCOPYBITS flag helps suppress some jittering during resizes.
At the moment this is called even for plain moves with no window
resizing. Make sure that the window geometry has changed before applying
the SWP_NOCOPYBITS flag
Fixes: QTBUG-115992
Pick-to: 6.6 6.5
Change-Id: Ic0cb32d9eb3b557bf2b2ef5b6ba80d34e27c5c19
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
When the -executable parameter is specified, macdeployqt uses
@loader_path instead of @rpath. This case was not handled in
getBinaryDependencies() used for the code signing.
Fixes: QTBUG-118075
Pick-to: 6.6
Change-Id: Ie1e0d0781305e1849df9ec0d5fb1c3ce6713a62b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Add two overloads to QNetworkAccessManager to support GET requests
with body.
Modify QNetworkReplyHttpImpl as well as these requests should not
be cached.
If the request is redirected it is possible that its type changes
from POST/PUT to GET and in this case the message body is deleted.
However, if a GET request has a body it should keep it after it has
been redirected - modify QNetworkReplyHttpImpl to keep the message
body after it has been redirected.
Fixes: QTBUG-112871
Change-Id: Ib01898638ed94238a98291870a5c51d56030868a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
The m_edges container isn't changed after it's initialized in the
constructor; so make it const.
This amends commit 641bccce2a.
Change-Id: I387eb2562475bc4910700d48f67303b0a5f80ccd
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
`QVFuncList` and `QStartUpFuncList` are identical typdefs
(`QtCleanUpFunction` and `QtStartUpFunction` are identical typedefs):
typedef QList<QtCleanUpFunction> QVFuncList;
typedef QList<QtStartUpFunction> QStartUpFuncList;
So from the compiler's POV QVFuncList and QStartUpFuncList can be used
interchangeably, but from a code reader's POV, this is confusing.
Use IILE to make the local variable const.
This amends commits 9429226524 and
a887891271.
Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-117242
Change-Id: I67f6af89027fe36a1915e815acd3c9446f7dcd5d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Saves us from having to create a lambda functor object.
Change-Id: I5e790e693b57ae414ac6d6be84f18b76b3e8185c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Mostly applying clang-format and clang-tidy fixits for:
- Redundant code (e.g. bool == true/false)
- Use member initializer list
- std::move for parameters taken by copy
Change-Id: I3b9a7f01db67291f889b42346a95c55ad74f054c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Slightly improves performance in the new benchmark
Change-Id: I2d71143ff7bc1f32ebb172f20be1843dec123e6c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When the Command key is pressed AppKit seems to do key equivalent
matching using a Latin/Roman interpretation of the current keyboard
layout.
For example, for a Greek layout, pressing Option+Command+C produces a
key event with chars="ç" and unmodchars="ψ", but AppKit still treats
this as a match for a key equivalent of Option+Command+C.
We can't do the same by just applying the modifiers to our key map,
as that too contains "ψ" for the Option+Command combination. What we
can do instead is take advantage of the fact that the Command modifier
layer in all/most keyboard layouts contains a Latin layer. We then
combine that with the modifiers of the event to produce the resulting
"Latin" key combination.
If the unmodified key is outside of Latin1, we also treat that as a
valid key combination, even if AppKit natively does not. For example,
for a Greek layout, we still want to support Option+Command+ψ as a key
combination, as it's unlikely to clash with the Latin key combination
we added above.
However, if the unmodified key is within Latin1, we skip it, to avoid
these types of conflicts. For example, in the same Greek layout, pressing
the key next to Tab will produce a Latin ';' symbol, but we've already
treated that as 'q', thanks to the Command modifier, so we skip the
potential Command+; key combination. This is also in line with what
AppKit natively does.
Fixes: QTBUG-96371
Fixes: QTBUG-79493
Task-number: QTBUG-112736
Change-Id: I30d678c1c7860642d3eed29c7757133ff74c6521
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
An incoming key event with a set of modifiers can potentially match
a range of key combinations, depending on how the event's modifiers
are combined to produce "intermediate" representations of the event.
For example, given a normal US keyboard layout, the virtual key
23 combined with the Alt (⌥) and Shift (⇧) modifiers, can map
to the following key combinations:
- Alt+Shift+5 (Fully expressed combination)
- Alt+% (Shift consumed to produce %)
- Shift+∞ (Alt consumed to produce ∞)
- fi (Shift and Alt consumed to produce fi)
But in other cases the intermediate modifier combinations
produce the same key/symbol as other modifier combinations.
For example, pressing Alt (⌥) and Shift (⇧) with the 'c'
key on a US layout will produce:
- Alt+Shift+C (Fully expressed combination)
- Shift+Ç (Alt consumed to produce Ç)
- Ç (Shift and Alt consumed to produce Ç)
In this case, we don't want to reflect the standalone 'Ç',
as that has already been reflected in the more direct form
via Shift+Ç. Consuming the additional Shift modifier does
not produce any additional symbols.
The same can happen without the number of modifiers being
different, in case two modifiers produce the same symbol.
In this case we want to prioritize Command over Option
over Control over Shift.
There is similar logic in the Windows and XKB key mappers,
and the implementation in the Apple key mapper has been
adapted from the Windows key mapper.
Task-number: QTBUG-67200
Task-number: QTBUG-38137
Change-Id: I4f1aeebac78a5393f8da804b53cf588f7c802c1b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>