OS X: Implement download folder display name query
Up to now, the download folder display name was queried using FSFindFolder and kDesktopFolderType. Now that NSFileManager can be used unconditionnaly, the query has been replaced to use NSFileManager. [ChangeLog][QtCore][OS X] QStandardPaths now returns the correct display name for the download folder. Task-number: QTBUG-50262 Change-Id: Ie16c8daea3261a4dd5ca051956fc08d51656e0fa Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
This commit is contained in:
parent
c689bcafd3
commit
018e670a26
@ -229,6 +229,14 @@ QString QStandardPaths::displayName(StandardLocation type)
|
||||
if (QStandardPaths::HomeLocation == type)
|
||||
return QCoreApplication::translate("QStandardPaths", "Home");
|
||||
|
||||
if (QStandardPaths::DownloadLocation == type) {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *url = [fileManager URLForDirectory:NSDownloadsDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
|
||||
if (!url)
|
||||
return QString();
|
||||
return QString::fromNSString([fileManager displayNameAtPath: [url absoluteString]]);
|
||||
}
|
||||
|
||||
FSRef ref;
|
||||
OSErr err = FSFindFolder(kOnAppropriateDisk, translateLocation(type), false, &ref);
|
||||
if (err)
|
||||
|
Loading…
Reference in New Issue
Block a user