Bug 412651 - File overwrite warning can be skipped
Summary: File overwrite warning can be skipped
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Tiar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-05 22:35 UTC by M
Modified: 2022-05-09 15:21 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M 2019-10-05 22:35:01 UTC
SUMMARY
The warning popup when trying to save a document through Save As... or Export... over an identically named file (+ format) in the folder is skipped if the File name input does not explicitly have the file ending written. This seems to only happen if the native file dialog option under Configure Krita > General > Miscellaneous is disabled.

STEPS TO REPRODUCE
1. Make sure the native file dialogs option is disabled
2. Open an image file in Krita and save it into a folder
3. Overwrite it through Save As..., leave the file name unchanged but remove the file ending
4. Change the file format from the Type drop-down and try overwriting that file too

OBSERVED RESULT
The overwrite warning dialog is skipped.

EXPECTED RESULT
The overwrite warning should appear just like when the file ending is written out.

SOFTWARE/OS VERSIONS
Tested in master build (git 9b45d78), AppImage (git 511ecc7) and 4.2.7 from repo, all showing the same behavior.

KDE Plasma 5.16.5 + Dolphin

ADDITIONAL INFORMATION
I'm using Plasma and Dolphin, in case that influences the behavior of the native file dialog.

Original context is this reddit topic:
https://www.reddit.com/r/krita/comments/dcztyv/krita_does_not_inform_me_there_is_another_file/
Comment 1 Halla Rempt 2019-10-07 13:02:36 UTC
https://bugreports.qt.io/browse/QTBUG-27186 seems relevant
Comment 2 Tiar 2019-10-30 17:28:52 UTC
Git commit b8073ac7a6a673e26ce6ea55eb3db77749e6e8f7 by Agata Cacko.
Committed on 30/10/2019 at 17:19.
Pushed by tymond into branch 'master'.

Make jp(e)g default extensions context-aware

This commit contains changes to Qt that enable two things:
- non-native file dialogs give .jpg or .jpeg extension depending
on the context:
1. If the current file is *.jp(e)g, suggest that extension.
2. Whether there are already files with this name
and extension in the directory, take that extension.
3. Take .jpg.
- "All" filter now suggests .kra extension instead of .exr.

A  +161  -0    3rdparty/ext_qt/0082-jpeg-extensions-handling-in-non-native-file-dialogs.patch
M  +5    -0    3rdparty/ext_qt/CMakeLists.txt

https://invent.kde.org/kde/krita/commit/b8073ac7a6a673e26ce6ea55eb3db77749e6e8f7
Comment 3 Tiar 2019-10-30 17:28:53 UTC
Git commit c5c9528b1d2c2b322eac516103cf22bfedee673a by Agata Cacko, on behalf of Friedemann Kleint.
Committed on 30/10/2019 at 17:19.
Pushed by tymond into branch 'master'.

Fix no warning for overwriting files in non-native dialogs

Before this commit, in case a user wanted to Save As "filename",
Krita would add an extension based on the selected filter.
In native file dialogs, Krita will warn user if it would
overwrite the file. In non-native file dialogs though
(based on Qt widgets), it wouldn't happen.

This commit makes it possible to append the extension before
the non-native file dialog is closed, which enables warning
before overwriting the file inside the file dialog.

This commit applies the patch from Qt bug report:
https://bugreports.qt.io/browse/QTBUG-27186
https://codereview.qt-project.org/c/qt/qtbase/+/109815/

Author of the patch and info from the original commit:
Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Task-number: QTBUG-27186
Change-Id: I3ece055b328dfe361b93e68954cb0a33bd9e7d94
"The Windows native dialog prefers the name filter over the
defaultSuffix (uses the same mechanism), I chose the convervative
approach here (defaultSuffix takes precedence)."

A  +123  -0    3rdparty/ext_qt/0081-non-native-file-dialog-overwrite-warnings-based-on-filter.patch
M  +5    -0    3rdparty/ext_qt/CMakeLists.txt

https://invent.kde.org/kde/krita/commit/c5c9528b1d2c2b322eac516103cf22bfedee673a
Comment 4 Tiar 2019-10-30 17:28:53 UTC
Git commit 5bc7a40b1ea6841df6144cdc3ffd893664283057 by Agata Cacko.
Committed on 30/10/2019 at 17:19.
Pushed by tymond into branch 'master'.

Make sure non-native file dialogs show extensions

Since the fix in the file dialog that was implemented
is based on extensions mentioned in the filter,
the filter needs to show the extensions...
It's a bit of an unwanted dependency between view and logic,
so it would be good to find a way to implement it wiser.

M  +1    -1    libs/widgetutils/KoFileDialog.cpp

https://invent.kde.org/kde/krita/commit/5bc7a40b1ea6841df6144cdc3ffd893664283057
Comment 5 Tiar 2019-12-11 12:51:33 UTC
Git commit 3fd9f4bc8009204746b908c2dc47f2cf1b257a04 by Agata Cacko.
Committed on 10/12/2019 at 18:55.
Pushed by tymond into branch 'krita/4.2'.

Make sure non-native file dialogs show extensions

Since the fix in the file dialog that was implemented
is based on extensions mentioned in the filter,
the filter needs to show the extensions...
It's a bit of an unwanted dependency between view and logic,
so it would be good to find a way to implement it wiser.

M  +1    -1    libs/widgetutils/KoFileDialog.cpp

https://invent.kde.org/kde/krita/commit/3fd9f4bc8009204746b908c2dc47f2cf1b257a04
Comment 6 Tiar 2019-12-11 12:51:33 UTC
Git commit 0932736885f7e6609f912f1ef2c48830b9508359 by Agata Cacko, on behalf of Friedemann Kleint.
Committed on 11/12/2019 at 12:47.
Pushed by tymond into branch 'krita/4.2'.

Fix no warning for overwriting files in non-native dialogs

Before this commit, in case a user wanted to Save As "filename",
Krita would add an extension based on the selected filter.
In native file dialogs, Krita will warn user if it would
overwrite the file. In non-native file dialogs though
(based on Qt widgets), it wouldn't happen.

This commit makes it possible to append the extension before
the non-native file dialog is closed, which enables warning
before overwriting the file inside the file dialog.

This commit applies the patch from Qt bug report:
https://bugreports.qt.io/browse/QTBUG-27186
https://codereview.qt-project.org/c/qt/qtbase/+/109815/

Author of the patch and info from the original commit:
Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Task-number: QTBUG-27186
Change-Id: I3ece055b328dfe361b93e68954cb0a33bd9e7d94
"The Windows native dialog prefers the name filter over the
defaultSuffix (uses the same mechanism), I chose the convervative
approach here (defaultSuffix takes precedence)."

A  +123  -0    3rdparty/ext_qt/0081-non-native-file-dialog-overwrite-warnings-based-on-filter.patch
M  +4    -0    3rdparty/ext_qt/CMakeLists.txt

https://invent.kde.org/kde/krita/commit/0932736885f7e6609f912f1ef2c48830b9508359
Comment 7 Tiar 2019-12-11 12:51:33 UTC
Git commit fa031e630b99b5782698adab6161ade45bee0b3d by Agata Cacko.
Committed on 11/12/2019 at 12:48.
Pushed by tymond into branch 'krita/4.2'.

Make jp(e)g default extensions context-aware

This commit contains changes to Qt that enable two things:
- non-native file dialogs give .jpg or .jpeg extension depending
on the context:
1. If the current file is *.jp(e)g, suggest that extension.
2. Whether there are already files with this name
and extension in the directory, take that extension.
3. Take .jpg.
- "All" filter now suggests .kra extension instead of .exr.

A  +161  -0    3rdparty/ext_qt/0082-jpeg-extensions-handling-in-non-native-file-dialogs.patch
M  +4    -0    3rdparty/ext_qt/CMakeLists.txt

https://invent.kde.org/kde/krita/commit/fa031e630b99b5782698adab6161ade45bee0b3d
Comment 8 Alvin Wong 2022-05-09 15:21:35 UTC
Git commit 9d1dd6ed529d23c3ec4806ce3b0e4428155d7830 by Alvin Wong, on behalf of Bourumir Wyngs.
Committed on 09/05/2022 at 15:13.
Pushed by alvinwong into branch 'master'.

Set default file suffix in save dialog

When using Qt's non-native QFileDialog, this is needed for the save
dialog to correctly append the default file extension, so that the
dialog can correctly prompt the user before overwriting an existing
file.
Related: bug 440122

M  +46   -13   libs/widgetutils/KoFileDialog.cpp
M  +6    -3    libs/widgetutils/KoFileDialog.h

https://invent.kde.org/graphics/krita/commit/9d1dd6ed529d23c3ec4806ce3b0e4428155d7830
Comment 9 Alvin Wong 2022-05-09 15:21:51 UTC
Git commit 45b8fd5f867e7ea9fedc488cd2e034a616ea36fc by Alvin Wong.
Committed on 09/05/2022 at 15:13.
Pushed by alvinwong into branch 'master'.

ext_qt: Remove patches adding default file suffix

They didn't work quite well and relied on specific options being set in
caller code, so we are replacing it and handle the default file suffix
from Krita directly.
Related: bug 440122

D  +0    -156  3rdparty/ext_qt/0081-Fix-no-warning-for-overwriting-files-in-non-native-d.patch
D  +0    -186  3rdparty/ext_qt/0082-Make-jp-e-g-default-extensions-context-aware.patch
M  +0    -6    3rdparty/ext_qt/CMakeLists.txt

https://invent.kde.org/graphics/krita/commit/45b8fd5f867e7ea9fedc488cd2e034a616ea36fc