|
|
@ -1411,6 +1411,7 @@ bool Preferences::isTorrentFileAssocSet() |
|
|
|
if (defaultHandlerId != NULL) |
|
|
|
if (defaultHandlerId != NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
|
|
|
|
if (myBundleId != NULL) |
|
|
|
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo; |
|
|
|
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo; |
|
|
|
CFRelease(defaultHandlerId); |
|
|
|
CFRelease(defaultHandlerId); |
|
|
|
} |
|
|
|
} |
|
|
@ -1423,10 +1424,12 @@ void Preferences::setTorrentFileAssoc() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (isTorrentFileAssocSet()) |
|
|
|
if (isTorrentFileAssocSet()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
const CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL); |
|
|
|
const CFStringRef torrentId = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, torrentExtension, NULL); |
|
|
|
if (torrentId != NULL) |
|
|
|
if (torrentId != NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
|
|
|
|
if (myBundleId != NULL) |
|
|
|
LSSetDefaultRoleHandlerForContentType(torrentId, kLSRolesViewer, myBundleId); |
|
|
|
LSSetDefaultRoleHandlerForContentType(torrentId, kLSRolesViewer, myBundleId); |
|
|
|
CFRelease(torrentId); |
|
|
|
CFRelease(torrentId); |
|
|
|
} |
|
|
|
} |
|
|
@ -1439,6 +1442,7 @@ bool Preferences::isMagnetLinkAssocSet() |
|
|
|
if (defaultHandlerId != NULL) |
|
|
|
if (defaultHandlerId != NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
|
|
|
|
if (myBundleId != NULL) |
|
|
|
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo; |
|
|
|
isSet = CFStringCompare(myBundleId, defaultHandlerId, 0) == kCFCompareEqualTo; |
|
|
|
CFRelease(defaultHandlerId); |
|
|
|
CFRelease(defaultHandlerId); |
|
|
|
} |
|
|
|
} |
|
|
@ -1449,7 +1453,9 @@ void Preferences::setMagnetLinkAssoc() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (isMagnetLinkAssocSet()) |
|
|
|
if (isMagnetLinkAssocSet()) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
const CFStringRef myBundleId = CFBundleGetIdentifier(CFBundleGetMainBundle()); |
|
|
|
|
|
|
|
if (myBundleId != NULL) |
|
|
|
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId); |
|
|
|
LSSetDefaultHandlerForURLScheme(magnetUrlScheme, myBundleId); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif // Q_OS_MACOS
|
|
|
|
#endif // Q_OS_MACOS
|
|
|
|