summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-10-04 10:56:05 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-10-09 11:15:37 +0000
commitf3911f8f2f818ec01d89ae55e2cebceffff97714 (patch)
tree40ebc1a361cbbe61223597419ca3e113b196d4c4
parentfba38be414eda0eda45c4f7b24a20d239255ca87 (diff)
macOS: Silence warning about supporting secure state restoration
We don't support or implement state restorations via the AppKit state restoration APIs, but if we did, we would/should support secure state restoration. This is the default for apps linked against the macOS 14 SDK, but as we target versions below that as well we need to return YES here explicitly to silence a runtime warning. Pick-to: 6.2 Fixes: QTBUG-117745 Change-Id: I0145504a79e53499852832d23dc7d4d6838dfa1b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit fc1549c01445bb9c99d3ba6de8fa9da230614e72) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 546dae9285fe97defdab73437d6ae2bf19b806d8)
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index e93d3b62bb..6027c779bb 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -320,6 +320,23 @@ QT_USE_NAMESPACE
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
QWindowSystemInterface::handleFileOpenEvent(QUrl(QString::fromNSString(urlString)));
}
+
+- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)application
+{
+ if (@available(macOS 12, *)) {
+ if ([reflectionDelegate respondsToSelector:_cmd])
+ return [reflectionDelegate applicationSupportsSecureRestorableState:application];
+ }
+
+ // We don't support or implement state restorations via the AppKit
+ // state restoration APIs, but if we did, we would/should support
+ // secure state restoration. This is the default for apps linked
+ // against the macOS 14 SDK, but as we target versions below that
+ // as well we need to return YES here explicitly to silence a runtime
+ // warning.
+ return YES;
+}
+
@end
@implementation QCocoaApplicationDelegate (Menus)