[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/26] ui/cocoa: Remove allowedFileTypes restriction in SavePanel
From: |
Peter Maydell |
Subject: |
[PULL 24/26] ui/cocoa: Remove allowedFileTypes restriction in SavePanel |
Date: |
Mon, 21 Feb 2022 09:27:58 +0000 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
setAllowedFileTypes is deprecated in macOS 12.
Per Akihiko Odaki [*]:
An image file, which is being chosen by the panel, can be a
raw file and have a variety of file extensions and many are not
covered by the provided list (e.g. "udf"). Other platforms like
GTK can provide an option to open a file with an extension not
listed, but Cocoa can't. It forces the user to rename the file
to give an extension in the list. Moreover, Cocoa does not tell
which extensions are in the list so the user needs to read the
source code, which is pretty bad.
Since this code is harming the usability rather than improving it,
simply remove the [NSSavePanel allowedFileTypes:] call, fixing:
[2789/6622] Compiling Objective-C object libcommon.fa.p/ui_cocoa.m.o
ui/cocoa.m:1411:16: error: 'setAllowedFileTypes:' is deprecated: first
deprecated in macOS 12.0 - Use -allowedContentTypes instead
[-Werror,-Wdeprecated-declarations]
[openPanel setAllowedFileTypes: supportedImageFileTypes];
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49:
note: property 'allowedFileTypes' is declared deprecated here
@property (nullable, copy) NSArray<NSString *> *allowedFileTypes
API_DEPRECATED("Use -allowedContentTypes instead", macos(10.3,12.0));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49:
note: 'setAllowedFileTypes:' has been explicitly marked deprecated here
FAILED: libcommon.fa.p/ui_cocoa.m.o
[*]
https://lore.kernel.org/qemu-devel/4dde2e66-63cb-4390-9538-c032310db3e3@gmail.com/
Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20220215080307.69550-11-f4bug@amsat.org
Reviewed by: Cameron Esfahani <dirty@apple.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Tested-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
ui/cocoa.m | 6 ------
1 file changed, 6 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index ac18e14ce01..7a1ddd4075f 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -100,7 +100,6 @@ static int gArgc;
static char **gArgv;
static bool stretch_video;
static NSTextField *pauseLabel;
-static NSArray * supportedImageFileTypes;
static QemuSemaphore display_init_sem;
static QemuSemaphore app_started_sem;
@@ -1168,10 +1167,6 @@ QemuCocoaView *cocoaView;
[pauseLabel setTextColor: [NSColor blackColor]];
[pauseLabel sizeToFit];
- // set the supported image file types that can be opened
- supportedImageFileTypes = [NSArray arrayWithObjects: @"img", @"iso",
@"dmg",
- @"qcow", @"qcow2", @"cloop", @"vmdk", @"cdr",
- @"toast", nil];
[self make_about_window];
}
return self;
@@ -1414,7 +1409,6 @@ QemuCocoaView *cocoaView;
openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles: YES];
[openPanel setAllowsMultipleSelection: NO];
- [openPanel setAllowedFileTypes: supportedImageFileTypes];
if([openPanel runModal] == NSModalResponseOK) {
NSString * file = [[[openPanel URLs] objectAtIndex: 0] path];
if(file == nil) {
--
2.25.1
- [PULL 15/26] hw/arm/armv7m: Handle disconnected clock inputs, (continued)
- [PULL 15/26] hw/arm/armv7m: Handle disconnected clock inputs, Peter Maydell, 2022/02/21
- [PULL 16/26] include: Move qemu_madvise() and related #defines to new qemu/madvise.h, Peter Maydell, 2022/02/21
- [PULL 17/26] include: Move qemu_mprotect_*() to new qemu/mprotect.h, Peter Maydell, 2022/02/21
- [PULL 19/26] include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h, Peter Maydell, 2022/02/21
- [PULL 20/26] include: Move hardware version declarations to new qemu/hw-version.h, Peter Maydell, 2022/02/21
- [PULL 23/26] hw/arm: add initial mori-bmc board, Peter Maydell, 2022/02/21
- [PULL 18/26] include: Move QEMU_MAP_* constants to mmap-alloc.h, Peter Maydell, 2022/02/21
- [PULL 26/26] ui/cocoa: Fix the leak of qemu_console_get_label, Peter Maydell, 2022/02/21
- [PULL 21/26] MAINTAINERS: Add Akihiko Odaki to macOS-relateds, Peter Maydell, 2022/02/21
- [PULL 25/26] ui/cocoa: Do not alert even without block devices, Peter Maydell, 2022/02/21
- [PULL 24/26] ui/cocoa: Remove allowedFileTypes restriction in SavePanel,
Peter Maydell <=
- [PULL 22/26] hw/timer: fix a9gtimer vmstate, Peter Maydell, 2022/02/21