From patchwork Mon Feb 21 09:27:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 544425 Delivered-To: patch@linaro.org Received: by 2002:ac0:e142:0:0:0:0:0 with SMTP id r2csp3111533imn; Mon, 21 Feb 2022 01:59:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJySYJADFXKXnEn8YTKT0TtPtWxcCTJM2wjYiHN8sPAhWX/AeawLZmgOP9ebOFwqZmum14SH X-Received: by 2002:ad4:5742:0:b0:424:5147:3f79 with SMTP id q2-20020ad45742000000b0042451473f79mr14509215qvx.45.1645437555111; Mon, 21 Feb 2022 01:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645437555; cv=none; d=google.com; s=arc-20160816; b=aZl6yHlMS8KGSlBGPdwJmbNJVSSFHPsaoz0MPH3mm1EREw/rU65c89OClUGfK2w9IQ 3p7CuONksSx2aVsWtXtSYVvVqKCbXGs8iBz2jH+YBZkZAsk0BaivbuSFitbFTCyHAdUJ aqy9v83L9RNl2cu4JtOKlgrywAsJuuc2JFIOhkHW4EeGQTc39DzJO5pJ/SqVvvx7XGF8 EDsT2ndZQgeQkm+E/Yspb/OlH2foaa38Y38ABVB+wt1RUEBD1YHbVsiz4MQBtyEEdcEe ZNOWJjCJjCgiNkQVzfJnUXGa9RJetXk2jxvLW4lzvyKMRFe/6icnQ50U5YTdakYjFPa3 NcDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=61CEyeaEKqT0X+d8dF55OnjNbWRRBgVyMed22FgL4ns=; b=xT0IxC2rrDEec0RCBL/dN1Uw5abFzD+Qr0u8tKSvVErv9EdgYHhXJfnxhd5K05PtOx EU43u2ZuDCb5mg0hJ3ycjgIHInpriK5NOQy2VhvfLSbgRnBserxzKa1qlTr9OproyNVH OGQdpjNhoatDuGdcKnv0bHxsMNnv5dWYKceZ/y7S3fmL5YJKBHLSVg61SjnG0+YgIWNu 7/zM2puFOKnhM4ECVoBBJHTl64QVlIXQ8x9zG8CjpfzlRQDxMeqYfJm2aEZwmEdRSBxS z11R6HN2W6O2/tGlVe6R4LjezZdBcwNq2bAxe4WNQK2aXAFH/fdxkW96IKFcRVoLZVEj uwZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJ2Fqpq6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f5si12069701qvd.470.2022.02.21.01.59.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Feb 2022 01:59:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJ2Fqpq6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nM5TO-0001Qi-Lq for patch@linaro.org; Mon, 21 Feb 2022 04:59:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nM4zo-0000Dt-Do for qemu-devel@nongnu.org; Mon, 21 Feb 2022 04:28:45 -0500 Received: from [2a00:1450:4864:20::32f] (port=38467 helo=mail-wm1-x32f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nM4zZ-00013Z-8C for qemu-devel@nongnu.org; Mon, 21 Feb 2022 04:28:37 -0500 Received: by mail-wm1-x32f.google.com with SMTP id k127-20020a1ca185000000b0037bc4be8713so13069668wme.3 for ; Mon, 21 Feb 2022 01:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=61CEyeaEKqT0X+d8dF55OnjNbWRRBgVyMed22FgL4ns=; b=VJ2Fqpq6i2TAtDDhwxGjufmn9e3g6/sg9n+qJUXhOnGF8GZB4rcxaMPU79WLRr4gpa Mm4QKNd1n6xKOpCyjMwDi7Ih6MyXSM0vT1ZMCWCgXWYy/JadqyGOIMp20X04irAhCP5k ZhZ31M+57eInoT8RqBdQt3bSAyDJrlrCGNCfqkHDVisCH4F20xZY1KR/6odY9/GlAEVy 3iH1RtuJfyRxt3KsR6TZlLnnpXSMxsFhLx7I3dzVctSXPX8ySv7cdbWH7AKScETCHCZi xYNliXXDZkfOZ55pZd/nOYI61uEPskovicOpRKoKbMX/dLfD9oKR/HnczuXy0teX3VGL nLWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=61CEyeaEKqT0X+d8dF55OnjNbWRRBgVyMed22FgL4ns=; b=DOncxj0LBmX+DRHfqFvqa8gmxzjC+PHjsh+V5BIAJ8jqQf0EDQsKDJ2mJf1pRqSnWw cbLmt8u1QQUdvOrS/j/sGd4CQx3aUF9FTZ2nyD9BQ1fU/wx/IJwZe59LqJxF079E9rph hNziHN/QyTGQGb1j8CfkwMggsuXgU+UozGpyojiy2D2uuvpXoypzCOXeectIo8FYWLR+ G5xG4z0RiElAxdq0aXwyvHd5Ml1EeTU0brStr7BuX5cEvtD3DDDFnSYu7CJjERg3DO3/ 8W/1F+jN0vziVFy227tjaV8TQbESYjBQ16G6WyzC9qg6Kl+o+qZuMLgYWAzquxIGIegD 9RIA== X-Gm-Message-State: AOAM533XEpG+PRjByKGdChtvBZPwhtpq4eFamquD8UsnjsvKepbc9igM 4qAPWHS3WP6/tQKN/RcMh4NRZ954sZG9wA== X-Received: by 2002:a05:600c:19ce:b0:37c:6fe:68b6 with SMTP id u14-20020a05600c19ce00b0037c06fe68b6mr20062988wmq.90.1645435701706; Mon, 21 Feb 2022 01:28:21 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q76sm7555778wme.1.2022.02.21.01.28.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 01:28:21 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/26] ui/cocoa: Remove allowedFileTypes restriction in SavePanel Date: Mon, 21 Feb 2022 09:27:58 +0000 Message-Id: <20220221092800.404870-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220221092800.404870-1-peter.maydell@linaro.org> References: <20220221092800.404870-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32f (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: 3 X-Spam_score: 0.3 X-Spam_bar: / X-Spam_report: (0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SUBJ_WIPE_DEBT=1.004, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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 *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 Reviewed-by: Roman Bolshakov Tested-by: Roman Bolshakov Reviewed-by: Christian Schoenebeck Signed-off-by: Philippe Mathieu-Daudé Message-id: 20220215080307.69550-11-f4bug@amsat.org Reviewed by: Cameron Esfahani Reviewed-by: Akihiko Odaki Tested-by: Akihiko Odaki Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Peter Maydell --- 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) {