UPD: Lazarus/StrToNSString() to (Native)Cocoa/StringToNSString()

(cherry picked from commit 6f46526451)
This commit is contained in:
rich2014 2026-01-03 10:46:41 +08:00 committed by Alexander Koblov
commit 806aef74ea
5 changed files with 15 additions and 14 deletions

View file

@ -8,8 +8,8 @@ interface
uses
Classes, SysUtils, LCLType, Menus,
uLng,
uDarwinFinderModel,
MacOSAll, CocoaAll, CocoaConst, CocoaTextEdits, CocoaUtils, Cocoa_Extra;
MacOSAll, CocoaAll, CocoaConst, CocoaTextEdits, CocoaUtils, Cocoa_Extra,
uDarwinFinderModel, uDarwinUtil;
const
FINDER_FAVORITE_TAGS_MENU_ITEM_SIZE = 20.0;
@ -617,7 +617,7 @@ begin
titleString:= NSURL( urls.objectAtIndex(0) ).lastPathComponent;
end else begin
formatString:= Format( rsMacOSAssignFinderTagsToMultiItems, [urls.count] );
titleString:= StrToNSString( formatString );
titleString:= StringToNSString( formatString );
end;
panel.setTitle( titleString );
panel.setTagNames( TDarwinFinderModelUtil.getTagNamesOfFiles(urls) );
@ -890,7 +890,7 @@ class procedure TDarwinFinderUtil.popoverTagsSelector(
var
panel: TFinderTagsEditorPanel;
begin
panel:= TFinderTagsEditorPanel.selectorWithTitle( StrToNSString(title) );
panel:= TFinderTagsEditorPanel.selectorWithTitle( StringToNSString(title) );
panel._onClose:= onClose;
panel.showPopover( positioningView, edge );
end;
@ -1109,11 +1109,11 @@ procedure TFinderFavoriteTagMenuItem.drawRect(dirtyRect: NSRect);
stateFontSize:= 11;
if _hover then begin
if _state = selectionAll then begin
stateString:= StrToNSString( 'x' );
stateString:= NSSTR( 'x' );
stateRect.origin.x:= stateRect.origin.x + 1;
stateFontSize:= 14;
end else begin
stateString:= StrToNSString( '+' );
stateString:= NSSTR( '+' );
stateFontSize:= 15;
end;
end else begin

View file

@ -8,7 +8,7 @@ interface
uses
Classes, SysUtils, LCLType,
sqldb, SQLite3Conn, syncobjs,
MacOSAll, CocoaAll, CocoaConst, CocoaUtils, Cocoa_Extra,
MacOSAll, CocoaAll, CocoaConst, Cocoa_Extra,
uDarwinFile, uDarwinUtil;
type
@ -427,7 +427,7 @@ end;
class procedure TDarwinFinderModelUtil.searchFilesBySavedSearch(
const path: String; const handler: TMacOSSearchResultHandler);
begin
TDarwinFinderModelUtil.searchFilesBySavedSearch( StrToNSString(path), handler );
TDarwinFinderModelUtil.searchFilesBySavedSearch( StringToNSString(path), handler );
end;
class procedure TDarwinFinderModelUtil.searchFilesForTagNames(

View file

@ -17,8 +17,9 @@ interface
uses
Classes, SysUtils, UnixType,
MacOSAll, CocoaAll, CocoaUtils,
uDarwinFile, uLog;
uLog,
MacOSAll, CocoaAll,
uDarwinFile, uDarwinUtil;
// TDarwinAarch64Statfs is the workaround for the bug of FPC.
// TDarwinAarch64Statfs and the related codes can be removed after FPC 3.3.1
@ -253,7 +254,7 @@ var
deviceID: String;
begin
deviceID:= ExtractFileName( fs^.mntfromname );
Result:= StrToNSString( deviceID );
Result:= StringToNSString( deviceID );
end;
function TDarwinIOVolumns.getVolumnByDeviceID(const deviceID: NSString

View file

@ -378,7 +378,7 @@ class procedure TSeedFileUtil.download(const aFile: TFile);
var
path: NSString;
begin
path:= StrToNSString( aFile.FullPath );
path:= StringToNSString( aFile.FullPath );
doDownload( path );
end;

View file

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, fgl, Graphics,
CocoaAll, CocoaUtils,
CocoaAll,
uDCUtils, uDarwinFile, uDarwinUtil, uiCloudDriveConfig;
type
@ -90,7 +90,7 @@ begin
if appIconNames = nil then
Exit;
appResourcePath:= StrToNSString( uDCUtils.ReplaceTilde(iCloudDriveConfig.path.container) + '/' + appFileName + '/' );
appResourcePath:= StringToNSString( uDCUtils.ReplaceTilde(iCloudDriveConfig.path.container) + '/' + appFileName + '/' );
appImage:= NSImage.new;
for appIconName in appIconNames do begin