mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: MacCloud/Options: step-152: notes configurable
This commit is contained in:
parent
6c27f206fd
commit
9c49da4e58
4 changed files with 44 additions and 16 deletions
|
|
@ -7,8 +7,8 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
CocoaAll,
|
||||
uCloudDriver;
|
||||
CocoaAll, uMiniCocoa,
|
||||
uCloudDriver, uWFXConfig;
|
||||
|
||||
type
|
||||
|
||||
|
|
@ -43,6 +43,8 @@ type
|
|||
message 'TConnectionConfigItem_creationTime';
|
||||
function modificationTime: TDateTime;
|
||||
message 'TConnectionConfigItem_modificationTime';
|
||||
function getNotes: NSString;
|
||||
message 'TConnectionConfigItem_getNotes';
|
||||
end;
|
||||
|
||||
{ TWFXConnectionConfigItems }
|
||||
|
|
@ -154,6 +156,16 @@ begin
|
|||
Result:= _modificationTime;
|
||||
end;
|
||||
|
||||
function TWFXConnectionConfigItem.getNotes: NSString;
|
||||
var
|
||||
configClass: TWFXCloudDriverConfigClass;
|
||||
notes: String;
|
||||
begin
|
||||
configClass:= WFXCloudDriverConfigManager.get( _driver.driverName );
|
||||
notes:= configClass.getNotes.Replace( '{driverName}', _driver.driverName );
|
||||
Result:= StringToNSString( notes );
|
||||
end;
|
||||
|
||||
{ TWFXConnectionConfigItems }
|
||||
|
||||
constructor TWFXConnectionConfigItems.Create;
|
||||
|
|
|
|||
|
|
@ -32,13 +32,6 @@ type
|
|||
|
||||
implementation
|
||||
|
||||
resourcestring
|
||||
rsAuthNotes =
|
||||
'1. Before successfully enabling the connection, Double Commander needs to obtain authorization from {driverName}'#13#13 +
|
||||
'2. Click the connect button to be redirected to the {driverName} official website in the Safari browser'#13#13 +
|
||||
'3. Please login your {driverName} account in Safari and authorize Double Commander to access'#13#13 +
|
||||
'4. The authorization is completed on the {driverName} official website, Double Commander will not get your password';
|
||||
|
||||
{ TWFXOAuth2PropertyView }
|
||||
|
||||
procedure TWFXOAuth2PropertyView.loadConnectionProperties( const index: Integer );
|
||||
|
|
@ -50,6 +43,7 @@ begin
|
|||
Exit;
|
||||
_logoImageView.setImage( TWFXPluginUtil.driverMainIcon(configItem.driver) );
|
||||
_nameTextField.setStringValue( configItem.name );
|
||||
_noteTextView.setString( configItem.getNotes );
|
||||
self.updateConnectStatus;
|
||||
end;
|
||||
|
||||
|
|
@ -58,7 +52,6 @@ var
|
|||
configItem: TWFXConnectionConfigItem;
|
||||
connectButtonText: String;
|
||||
statusImageName: NSString;
|
||||
notes: String;
|
||||
begin
|
||||
configItem:= _controller.currentConfigItem;
|
||||
if configItem.driver.authorized then begin
|
||||
|
|
@ -70,8 +63,6 @@ begin
|
|||
end;
|
||||
_statusImageview.setImage( NSImage.imageNamed(statusImageName) );
|
||||
_connectButton.setTitle( StringToNSString(connectButtonText) );
|
||||
notes:= rsAuthNotes.Replace( '{driverName}', configItem.driver.driverName );
|
||||
_noteTextView.setString( StringToNSString(notes) );
|
||||
end;
|
||||
|
||||
procedure TWFXOAuth2PropertyView.connectOrDisconnect(sender: NSObject);
|
||||
|
|
|
|||
|
|
@ -86,9 +86,6 @@ resourcestring
|
|||
rsRegionUserCustom = '(User Custom)';
|
||||
rsParamsAlertTitle = 'Incomplete Parameters';
|
||||
rsParamsAlertText = 'Access Key ID and Secret Access Key are required, please make sure they are correct. If permissions are insufficient or you are setting "S3 Compatible", Region / Endpoint / Bucket is also required.';
|
||||
rsAuthNotes =
|
||||
'1. AccessKeyID and SerectAccessKey will be saved in the macOS KeyChains to obtain system-level security. The confidential data can only be read by your own macOS permissions.'#13#13 +
|
||||
'2. Access Key ID and Secret Access Key are required, and the others are optional. Double Commander can usually automatically obtain others such as Buckets. Therefore, Region / EndPoint / Bucket are only required if Access Key permissions are insufficient.';
|
||||
|
||||
{ TWFXS3RegionConfigItem }
|
||||
|
||||
|
|
@ -240,6 +237,7 @@ begin
|
|||
regionIndex:= _regionItems.indexOfRegion( _regionTextField.stringValue );
|
||||
if regionIndex >= 0 then
|
||||
_regionDropDown.selectItemAtIndex( regionIndex + 1 );
|
||||
_noteTextView.setString( configItem.getNotes );
|
||||
end;
|
||||
|
||||
procedure TWFXS3PropertyView.saveConnection(sender: NSObject);
|
||||
|
|
@ -358,7 +356,6 @@ begin
|
|||
_noteTextView.setFont( NSFont.systemFontOfSize(11));
|
||||
_noteTextView.setEditable( False );
|
||||
_noteTextView.setDrawsBackground( False );
|
||||
_noteTextView.setString( StringToNSString(rsAuthNotes) );
|
||||
self.addSubView( _noteTextView );
|
||||
_noteTextView.release;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ type
|
|||
class procedure saveConnectionCommon( const driver: TCloudDriver; const params: NSMutableDictionary ); virtual; abstract;
|
||||
class procedure loadConnectionSecurity( const driver: TCloudDriver; const params: NSDictionary ); virtual; abstract;
|
||||
class procedure saveConnectionSecurity( const driver: TCloudDriver; const params: NSMutableDictionary ); virtual; abstract;
|
||||
class function getNotes: String; virtual; abstract;
|
||||
end;
|
||||
|
||||
TWFXCloudDriverConfigClass = class of TWFXCloudDriverConfig;
|
||||
|
|
@ -45,6 +46,7 @@ type
|
|||
public
|
||||
class procedure initMacCloudDriverManager;
|
||||
procedure register( const name: String; const config: TWFXCloudDriverConfigClass );
|
||||
function get( const name: String ): TWFXCloudDriverConfigClass;
|
||||
procedure loadFromCommon( const path: String );
|
||||
procedure saveToCommon( const path: String );
|
||||
procedure loadFromSecurity;
|
||||
|
|
@ -70,6 +72,15 @@ resourcestring
|
|||
rsQiniuKODODisplayName = 'Qiniu Cloud KODO';
|
||||
rsUpyunUSSDisplayName = 'Upyun USS';
|
||||
|
||||
rsOAuth2AuthNotes =
|
||||
'1. Before successfully enabling the connection, Double Commander needs to obtain authorization from {driverName}'#13#13 +
|
||||
'2. Click the connect button to be redirected to the {driverName} official website in the Safari browser'#13#13 +
|
||||
'3. Please login your {driverName} account in Safari and authorize Double Commander to access'#13#13 +
|
||||
'4. The authorization is completed on the {driverName} official website, Double Commander will not get your password';
|
||||
rsS3AuthNotes =
|
||||
'1. AccessKeyID and SerectAccessKey will be saved in the macOS KeyChains to obtain system-level security. The confidential data can only be read by your own macOS permissions.'#13#13 +
|
||||
'2. Access Key ID and Secret Access Key are required, and the others are optional. Double Commander can usually automatically obtain others such as Buckets. Therefore, Region / EndPoint / Bucket are only required if Access Key permissions are insufficient.';
|
||||
|
||||
type
|
||||
|
||||
{ TWFXTokenCloudDriverConfig }
|
||||
|
|
@ -81,6 +92,7 @@ type
|
|||
class procedure saveConnectionCommon( const driver: TCloudDriver; const params: NSMutableDictionary ); override;
|
||||
class procedure loadConnectionSecurity( const driver: TCloudDriver; const params: NSDictionary ); override;
|
||||
class procedure saveConnectionSecurity( const driver: TCloudDriver; const params: NSMutableDictionary ); override;
|
||||
class function getNotes: String; override;
|
||||
class function cloudDriverConfigPtr: TTokenCloudDriverConfigPtr; virtual; abstract;
|
||||
class function cloudDriverClass: TCloudDriverClass; virtual; abstract;
|
||||
end;
|
||||
|
|
@ -122,6 +134,7 @@ type
|
|||
class procedure saveConnectionCommon( const driver: TCloudDriver; const params: NSMutableDictionary ); override;
|
||||
class procedure loadConnectionSecurity( const driver: TCloudDriver; const params: NSDictionary ); override;
|
||||
class procedure saveConnectionSecurity( const driver: TCloudDriver; const params: NSMutableDictionary ); override;
|
||||
class function getNotes: String; override;
|
||||
end;
|
||||
|
||||
{ TWFXTokenCloudDriverConfig }
|
||||
|
|
@ -188,6 +201,11 @@ begin
|
|||
jsonToken.release;
|
||||
end;
|
||||
|
||||
class function TWFXTokenCloudDriverConfig.getNotes: String;
|
||||
begin
|
||||
Result:= rsOAuth2AuthNotes;
|
||||
end;
|
||||
|
||||
{ TWFXDropBoxConfig }
|
||||
|
||||
class function TWFXDropBoxConfig.cloudDriverConfigPtr: TTokenCloudDriverConfigPtr;
|
||||
|
|
@ -308,6 +326,11 @@ begin
|
|||
jsonAccessKey.release;
|
||||
end;
|
||||
|
||||
class function TWFXS3Config.getNotes: String;
|
||||
begin
|
||||
Result:= rsS3AuthNotes;
|
||||
end;
|
||||
|
||||
{ TWFXCloudDriverConfigManager }
|
||||
|
||||
constructor TWFXCloudDriverConfigManager.Create;
|
||||
|
|
@ -402,6 +425,11 @@ begin
|
|||
_configItems.Add( name, config );
|
||||
end;
|
||||
|
||||
function TWFXCloudDriverConfigManager.get( const name: String ): TWFXCloudDriverConfigClass;
|
||||
begin
|
||||
Result:= TWFXCloudDriverConfigClass( _configItems[name] );
|
||||
end;
|
||||
|
||||
procedure TWFXCloudDriverConfigManager.loadFromSecurity;
|
||||
procedure loadConnectionsSecurity( const jsonConnections: NSArray );
|
||||
var
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue