Bug 429056

Summary: Resaving with different mime type does not work on Android
Product: [Applications] krita Reporter: Anna Medonosova <anna.medonosova>
Component: File formatsAssignee: sh_zam <shzam>
Status: RESOLVED FIXED    
Severity: normal CC: shzam
Priority: NOR    
Version: 4.4.0   
Target Milestone: ---   
Platform: Android   
OS: Android 10.x   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Anna Medonosova 2020-11-13 11:26:57 UTC
SUMMARY
When trying to save a file, which was opened as JPG, to the native KRA format, JPG file is saved instead of KRA. The native file dialog on Android does not allow me to select a mime type; the suffix of the file name I entered is not considered.

STEPS TO REPRODUCE
1. Open a JPG file 
2. Make a change
3. File -> Save As, rename the file to ‘testfile.kra’

OBSERVED RESULT
On disk, there is a file called testfile.kra.jpg, which is a JPG, not KRA.

EXPECTED RESULT
I would expect either being able to select a mime type in the file dialog or that the saving process selecting a mime type for the file according to the suffix I input.
Comment 1 sh_zam 2020-11-16 08:11:47 UTC
Git commit 7f211e12f0fe60090b75130a747c6e726803a12c by Sharaf Zaman.
Committed on 16/11/2020 at 08:08.
Pushed by szaman into branch 'krita/4.3'.

Android: don't set nameFilters when exporting

Android docs suggest two ways to pass mime info to the Storage Framework
1. Intent#setType() -- when mimetype belongs to some specific category e.g image/*
2. Intent#EXTRA_MIME_TYPES -- for disjoint ones.

But Qt always uses the first mimetype in the list as setType, which for certain
concrete mimeTypes (like image/jpeg), defaults the extension to .jpg which
we/user can't change.

M  +2    -0    libs/widgetutils/KoFileDialog.cpp

https://invent.kde.org/graphics/krita/commit/7f211e12f0fe60090b75130a747c6e726803a12c
Comment 2 sh_zam 2020-11-17 16:15:45 UTC
Git commit 046fbdce77538cc2e7b97ea6d571c5794bc478fa by Sharaf Zaman.
Committed on 17/11/2020 at 16:05.
Pushed by szaman into branch 'master'.

Android: don't set nameFilters when exporting

Android docs suggest two ways to pass mime info to the Storage Framework
1. Intent#setType() -- when mimetype belongs to some specific category e.g image/*
2. Intent#EXTRA_MIME_TYPES -- for disjoint ones.

But Qt always uses the first mimetype in the list as setType, which for certain
concrete mimeTypes (like image/jpeg), defaults the extension to .jpg which
we/user can't change.
(cherry picked from commit 7f211e12f0fe60090b75130a747c6e726803a12c)

M  +2    -0    libs/widgetutils/KoFileDialog.cpp

https://invent.kde.org/graphics/krita/commit/046fbdce77538cc2e7b97ea6d571c5794bc478fa