mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: check if Full Disk Access permission has been granted, if so hide the Privilege Button on the ToolBar
This commit is contained in:
parent
05c1e0e6bb
commit
a62f046a94
3 changed files with 41 additions and 7 deletions
|
|
@ -225,7 +225,9 @@ begin
|
|||
InitPasswordStore;
|
||||
LoadPixMapManager;
|
||||
{$IF DEFINED(DARWIN)}
|
||||
initCocoaModernFormConfig;
|
||||
{$if NOT defined(DisableCocoaModernForm)}
|
||||
TDCCocoaModernFormUtils.initConfig;
|
||||
{$endif}
|
||||
iCloudDriveConfigUtil.load;
|
||||
{$ENDIF}
|
||||
Application.CreateForm(TfrmMain, frmMain); // main form
|
||||
|
|
|
|||
|
|
@ -972,6 +972,9 @@ uses
|
|||
uColumnsFileView, dmHigh, uFileSourceOperationMisc
|
||||
{$IFDEF MSWINDOWS}
|
||||
, uShellFileSource, uNetworkThread
|
||||
{$ENDIF}
|
||||
{$IFDEF DARWIN}
|
||||
, uCocoaModernFormConfig
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
|
|
@ -1270,6 +1273,9 @@ begin
|
|||
TDarwinFileViewUtil.init( @ActiveNotebook, @ActiveFrame );
|
||||
if gForceFunctionKey then
|
||||
Application.OnIdle:= @installMacOSFNKeyTap;
|
||||
{$if NOT defined(DisableCocoaModernForm)}
|
||||
TDCCocoaModernFormUtils.checkAndSetPrivilegeItem;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,15 @@ uses
|
|||
CocoaAll, CocoaConfig, CocoaToolBar, CocoaThemes, Cocoa_Extra,
|
||||
LResources, uTranslator, Translations;
|
||||
|
||||
procedure initCocoaModernFormConfig;
|
||||
type
|
||||
|
||||
{ TDCCocoaModernFormUtils }
|
||||
|
||||
TDCCocoaModernFormUtils = class
|
||||
class procedure initConfig;
|
||||
class function isEnabled: Boolean;
|
||||
class procedure checkAndSetPrivilegeItem;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
|
|
@ -108,12 +116,9 @@ begin
|
|||
];
|
||||
end;
|
||||
|
||||
procedure initCocoaModernFormConfig;
|
||||
class procedure TDCCocoaModernFormUtils.initConfig;
|
||||
begin
|
||||
if gModernUI = false then
|
||||
Exit;
|
||||
|
||||
if NSAppKitVersionNumber < NSAppKitVersionNumber11_0 then
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
Exit;
|
||||
|
||||
fMain.onFileViewUpdated:= @onFileViewUpdated;
|
||||
|
|
@ -122,5 +127,26 @@ begin
|
|||
doInitConfig;
|
||||
end;
|
||||
|
||||
class function TDCCocoaModernFormUtils.isEnabled: Boolean;
|
||||
begin
|
||||
Result:= gModernUI and TDarwinApplicationUtil.supportsModernForm;
|
||||
end;
|
||||
|
||||
class procedure TDCCocoaModernFormUtils.checkAndSetPrivilegeItem;
|
||||
var
|
||||
toolBar: NSToolBar;
|
||||
index: Integer;
|
||||
begin
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
Exit;
|
||||
|
||||
if NOT TDarwinApplicationUtil.hasFullDiskAccess then
|
||||
Exit;
|
||||
|
||||
toolBar:= TCocoaToolBarUtils.getToolBar( frmMain );
|
||||
index:= TCocoaToolBarUtils.findItemIndexByIdentifier( toolBar, 'MainForm.Privilege' );
|
||||
TCocoaToolBarUtils.removeItemByIndex( toolBar, index );
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue