diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-02-12 21:11:34 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-02-19 18:03:11 +0100 |
commit | 2a2a30155719d9175f92467a42e0deac5aad3767 (patch) | |
tree | f47bdd66f7171c4aafbf6084f50b85612fda7da9 /src/corelib/io/qfilesystemengine_unix.cpp | |
parent | d311af49636a7f976b804bc92b1431d8d96ebc61 (diff) |
Apple: Fix a few deprecation warnings after bumping deployment targets
- kIOMasterPortDefault -> kIOMainPortDefault
- Use UTType instead of Carbon Core functions/constants
- NSWorkspace iconForFileType -> iconForContentType
- Removed obsoleted kUTTypeInkText pasteboard type
There are still a few more, but these will be fixed in follow ups.
Change-Id: Ibbca226d578b4ba64bd9c8c5d0addc1870114a20
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/corelib/io/qfilesystemengine_unix.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 7d7f74c88a..5dbe7f3e9b 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -39,6 +39,11 @@ #if defined(Q_OS_DARWIN) # include <QtCore/private/qcore_mac_p.h> # include <CoreFoundation/CFBundle.h> +# include <UniformTypeIdentifiers/UTType.h> +# include <UniformTypeIdentifiers/UTCoreTypes.h> +# include <Foundation/Foundation.h> +# include <sys/clonefile.h> +# include <copyfile.h> #endif #ifdef Q_OS_MACOS @@ -49,15 +54,6 @@ #include <MobileCoreServices/MobileCoreServices.h> #endif -#if defined(Q_OS_DARWIN) -# include <sys/clonefile.h> -# include <copyfile.h> -// We cannot include <Foundation/Foundation.h> (it's an Objective-C header), but -// we need these declarations: -Q_FORWARD_DECLARE_OBJC_CLASS(NSString); -extern "C" NSString *NSTemporaryDirectory(); -#endif - #if defined(Q_OS_LINUX) # include <sys/ioctl.h> # include <sys/sendfile.h> @@ -127,10 +123,9 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e QString suffix = info.suffix(); if (suffix.length() > 0) { - // First step: is the extension known ? - QCFType<CFStringRef> extensionRef = suffix.toCFString(); - QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL); - if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle)) + // First step: is it a bundle? + const auto *utType = [UTType typeWithFilenameExtension:suffix.toNSString()]; + if ([utType conformsToType:UTTypeBundle]) return true; // Second step: check if an application knows the package type |