permissions: Handle EKAuthorizationStatusWriteOnly on macOS 14/iOS 17

For now we do not have a QCalendarPermission::AccessMode::WriteOnly,
so we have to report Qt::PermissionStatus::Denied.

Fixes: QTBUG-114864
Pick-to: 6.5 6.6
Change-Id: I94e92912ef4c24adb524ccf2cf28553115d6781b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-06-27 17:55:24 +02:00
parent 9526a76936
commit 2736e908e9

View File

@ -5,8 +5,6 @@
#include <EventKit/EventKit.h>
QT_DEFINE_PERMISSION_STATUS_CONVERTER(EKAuthorizationStatus);
@interface QDarwinCalendarPermissionHandler ()
@property (nonatomic, retain) EKEventStore *eventStore;
@end
@ -20,8 +18,22 @@ QT_DEFINE_PERMISSION_STATUS_CONVERTER(EKAuthorizationStatus);
- (Qt::PermissionStatus)currentStatus
{
const auto status = [EKEventStore authorizationStatusForEntityType:EKEntityTypeEvent];
return nativeStatusToQtStatus(status);
switch ([EKEventStore authorizationStatusForEntityType:EKEntityTypeEvent]) {
case EKAuthorizationStatusNotDetermined:
return Qt::PermissionStatus::Undetermined;
case EKAuthorizationStatusRestricted:
case EKAuthorizationStatusDenied:
return Qt::PermissionStatus::Denied;
case EKAuthorizationStatusAuthorized:
return Qt::PermissionStatus::Granted;
#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(140000, 170000)
case EKAuthorizationStatusWriteOnly:
// FIXME: Add WriteOnly AccessMode
return Qt::PermissionStatus::Denied;
#endif
}
Q_UNREACHABLE();
}
- (QStringList)usageDescriptionsFor:(QPermission)permission