Commit Graph

6 Commits

Author SHA1 Message Date
Oliver Eftevaag 000e0ec516 Only update the filename text field when the user selects a file
Apparently, it's normal for file dialogs to not update the text field
that represents the filename of the currently selected file, if the
selected file is a directory.

To achieve that behavior, I'm removing the binding on the text property,
and instead call setText() to update the text field when either the user
selects another file in the file dialog list view, or when the
selectedFile is changed externally. But only if the selectedFile is an
actual real file, and not a directory.

Fixes: QTBUG-119917
Pick-to: 6.5
Change-Id: I8dbf41ba403d09419a2d66130bdad59e66c9d1cf
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 8e734b2fc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ddee70ac8c)
2024-01-11 11:33:45 +00:00
Oliver Eftevaag 025c130c1e FileDialog: prompt the user when selecting an existing file
It is common for editing software to prompt the user when he/she wishes
to save the work done in the editor, and an existing file is selected in
the file dialog. This is an extra safety step, to hopefully prevent the
user from accidentally shooting himself/herself in the foot, by
overwriting an existing file and losing something valuable.

One of the available file dialog option is DontConfirmOverwrite.
Which according to the documentation, could be set in order to bypass
a confirmation which is supposed to show up by default.
But that weren't the case when using the non-native quick file dialog.

The FileDialog will now show that confirmation dialog as a popup
dialog, which popups up on top of the FileDialog, when selecting an
existing file using the SaveFile file mode.

The DontConfirmOverwrite option can now be used as intended, which will
make the FileDialog behave like it used to, when selecting an existing
file.

In additon, hitting enter while the file dialog list view has focus,
will now function the same as clicking the "Open" button. This was done
in order to prevent the user from being able to bypass the new
confirmation dialog.

Fixes: QTBUG-119916
Pick-to: 6.5
Change-Id: I07710a7126c53f489fd5554ea21e7684244a93c1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1cc20d181b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d340459e7c)
2023-12-23 22:08:48 +00:00
Eirik Aavitsland 8d006425f8 Check if QQuickFileDialogImplPrivate::options is null before deref
A recent fix introduced an unchecked deref of d->options. No problem
has been observed, but all other usages in this file are guarded, so
avoid introducing a potential crash.

Pick-to: 6.5
Change-Id: I3602808c42094d24ba08d32612af3d3e95e90279
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
(cherry picked from commit 8ba21bb39f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d92f73f768)
2023-12-15 17:29:24 +00:00
Eirik Aavitsland 100ffa6a30 Fix accept button enabled state in non-native file dialog
When editing save file name in the line edit, and changing it from
empty to non-empty or the other way around, the accept (Save) button
would not be enabled/disabled accordingly.

Can be tested with the qml file from the linked task.

Task-number: QTBUG-101552
Task-number: QTBUG-108455
Change-Id: Icc0ea5f68cfe06e95f54839cf4bd930bd8d57daf
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 62126f6581)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 17:58:13 +00:00
Eirik Aavitsland 296f56004e Fix default button label for non-native file dialog in SaveFile mode
It would use the OpenFile label independently of actual mode.

Fixes: QTBUG-105080
Change-Id: Ia529f6854dd676197af99cbe0a610f5833181ce2
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
(cherry picked from commit 9184766ea9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 17:58:05 +00:00
Mitch Curtis 4bd87b903b Remove "2" from Qt Quick Controls directories
Qt Quick Controls 2 was named that way because it was a follow-up to
Qt Quick Controls 1.x. Now that Qt Quick Controls 1 is no longer
supported, we don't need to have "2" in the name. Work on this was
already started for the documentation in
1abdfe5d5a.

By doing this renaming a few weeks before feature freeze, it won't
affect the release but still results in as little time possible spent
manually fixing conflicts in cherry-picks from non-LTS releases as a
result of the renaming.

This patch does the following:

- Renames directories.
- Adapts CMakeLists.txt and other files to account for the new paths.

A follow-up patch will handle documentation.

It does not touch library names or other user-facing stuff, as that
will have to be done in Qt 7.

Task-number: QTBUG-95413
Change-Id: I170d8db19033ee71e495ff0c5c1a517a41ed7634
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-12-01 10:26:20 +08:00