From bde2979aa0fa407e116925dbbadfa53536ab4613 Mon Sep 17 00:00:00 2001 From: zeljko Date: Mon, 9 Feb 2015 08:44:40 +0000 Subject: [PATCH] Carbon,Cocoa,QtCocoa: replaced outdated LSOpenCFURLRef.Now qtcocoa 64bit can be build w/o problems.Patch by Karl-Michael Schindler. issue #26890 git-svn-id: trunk@47654 - --- lcl/include/sysenvapis_mac.inc | 10 ++++++---- lcl/lclintf.pas | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lcl/include/sysenvapis_mac.inc b/lcl/include/sysenvapis_mac.inc index c5eb067761..b203ffff3e 100644 --- a/lcl/include/sysenvapis_mac.inc +++ b/lcl/include/sysenvapis_mac.inc @@ -3,15 +3,17 @@ // Open a given URL with the default browser function OpenURL(AURL: String): Boolean; var - url: CFURLRef; + url: NSURL; + ws: NSWorkspace; begin + Result := False; if AURL = '' then Exit(False); - url := CFURLCreateWithBytes(nil, @AURL[1], Length(AURL), kCFStringEncodingUTF8, nil); + url := NSURL.URLWithString(NSStr(@AURL[1])); if not Assigned(url) then Exit(False); - Result := LSOpenCFURLRef(url, nil) = 0; - CFRelease(url); + ws := NSWorkspace.sharedWorkspace; + Result := ws.openURL(url); end; // Open a document with the default application associated with it in the system diff --git a/lcl/lclintf.pas b/lcl/lclintf.pas index f6b5459649..4dc759650d 100644 --- a/lcl/lclintf.pas +++ b/lcl/lclintf.pas @@ -40,12 +40,16 @@ unit LCLIntf; {$mode objfpc}{$H+} {$inline on} +{$IFDEF DARWIN} + {$modeswitch objectivec1} +{$ENDIF} + interface uses {$IFDEF Windows}Windows, ShellApi,{$ENDIF} {$IFDEF UNIX}Unix, {$ENDIF} - {$IFDEF Darwin}MacOSAll, {$ENDIF} + {$IFDEF Darwin}MacOSAll, CocoaAll,{$ENDIF} Types, Math, Classes, SysUtils, LCLType, LCLProc, GraphType, InterfaceBase, LResources, FileUtil, UTF8Process, Maps, LMessages, LazUTF8, lazutf8sysutils, LCLStrConsts;