Skip to content

Commit

Permalink
Merge pull request #303 from pozitronik/plugin_class
Browse files Browse the repository at this point in the history
Plugin interface converted to a class
  • Loading branch information
pozitronik authored Dec 12, 2023
2 parents e8bd054 + 6862e1a commit b7bf2d6
Show file tree
Hide file tree
Showing 13 changed files with 2,127 additions and 1,878 deletions.
1,779 changes: 29 additions & 1,750 deletions MailRuCloud.dpr

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions MailRuCloud.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@
<DCCReference Include="models\TCRequest.pas"/>
<DCCReference Include="models\WSList.pas"/>
<DCCReference Include="helpers\WindowsHelper.pas"/>
<DCCReference Include="models\wfx\MailRuCloudWFX.pas"/>
<DCCReference Include="models\wfx\WFXInterface.pas"/>
<RcItem Include="icons\icon.ico">
<ResourceType>ICON</ResourceType>
<ResourceId>base_icon</ResourceId>
Expand Down
33 changes: 21 additions & 12 deletions forms/Accounts.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ object AccountsForm: TAccountsForm
object AccountNameLabel: TLabel
Left = 225
Top = 10
Width = 68
Width = 62
Height = 13
Anchors = [akLeft, akTop, akRight]
Caption = 'Account name'
ExplicitWidth = 68
end
object AccountsGroupBox: TGroupBox
Left = -4
Expand Down Expand Up @@ -352,11 +353,10 @@ object AccountsForm: TAccountsForm
object AccountNameEdit: TEdit
Left = 225
Top = 27
Width = 249
Width = 243
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
ExplicitWidth = 243
end
object PublicAccountCB: TCheckBox
Left = 225
Expand Down Expand Up @@ -982,42 +982,47 @@ object AccountsForm: TAccountsForm
object ExtLabel: TLabel
Left = 225
Top = 10
Width = 66
Width = 60
Height = 13
Anchors = [akLeft, akTop, akRight]
Caption = 'File extension'
ExplicitWidth = 66
end
object CommandLabel: TLabel
Left = 225
Top = 52
Width = 47
Width = 41
Height = 13
Anchors = [akLeft, akTop, akRight]
Caption = 'Command'
ExplicitWidth = 47
end
object ParametersLabel: TLabel
Left = 225
Top = 93
Width = 227
Width = 221
Height = 13
Anchors = [akLeft, akTop, akRight]
Caption = 'Parameters (%url% for stream url substitution)'
ExplicitWidth = 227
end
object StartPathLabel: TLabel
Left = 225
Top = 134
Width = 49
Width = 43
Height = 13
Anchors = [akLeft, akTop, akRight]
Caption = 'Start path'
ExplicitWidth = 49
end
object StreamingTypeLabel: TLabel
Left = 225
Top = 177
Width = 73
Width = 67
Height = 13
Anchors = [akLeft, akTop, akRight]
Caption = 'Streaming type'
ExplicitWidth = 73
end
object TExtensionsGroupBox: TGroupBox
Left = -4
Expand Down Expand Up @@ -1047,18 +1052,20 @@ object AccountsForm: TAccountsForm
object StreamingExtensionEdit: TEdit
Left = 225
Top = 27
Width = 249
Width = 243
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 1
ExplicitWidth = 249
end
object CommandPathEdit: TEdit
Left = 225
Top = 69
Width = 228
Width = 222
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 2
ExplicitWidth = 228
end
object CommandPathButton: TButton
Left = 459
Expand All @@ -1072,18 +1079,20 @@ object AccountsForm: TAccountsForm
object ParametersEdit: TEdit
Left = 225
Top = 110
Width = 249
Width = 243
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 4
ExplicitWidth = 249
end
object StartPathEdit: TEdit
Left = 225
Top = 151
Width = 249
Width = 243
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 5
ExplicitWidth = 249
end
object StreamingTypeCombo: TComboBox
Left = 225
Expand Down
2 changes: 1 addition & 1 deletion forms/DeletedProperty.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface
CMRDirItem,
CloudMailRu,
SETTINGS_CONSTANTS,
LANGUAGE_STRINGS,
LANGUAGE_STRINGS,
CMRConstants,
PluginHelper,
DateUtils,
Expand Down
1 change: 0 additions & 1 deletion forms/Registration.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ interface
ConnectionSettings,
Vcl.Imaging.JPEG;


type
TRegistrationForm = class(TForm)
FirstNameLabel: TLabel;
Expand Down
12 changes: 0 additions & 12 deletions helpers/PluginHelper.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ interface
CMRConstants,
SysUtils;

const
//FsFindFirst* success return codes (INVALID_HANDLE_VALUE returns on error)
FIND_NO_MORE_FILES = 0;
FIND_OK = 1;
FIND_ROOT_DIRECTORY = 2;
FIND_SHARED_LINKS = 3; //.shared folder

TYPE_AUTO = -1;
TYPE_BYTES = 0;
TYPE_KYLOBYTES = 1;
TYPE_MEGABYTES = 2;

function FormatSize(size: Int64; SizeType: integer = TYPE_AUTO): WideString; //Форматируем размер в удобочитаемый вид
function ShardTypeFromStreamingFormat(StreamingFormat: integer): string;

Expand Down
3 changes: 2 additions & 1 deletion models/ConnectionManager.pas
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ function TConnectionManager.GetProxyPassword: Boolean;

if ProxySettings.UseTCPasswordManager and (PasswordManager.GetPassword('proxy' + ProxySettings.User, ProxySettings.password) = FS_FILE_OK) then {retrieve the proxy password from TC passwords storage}
Result := True{Password is retrieved and should be updated in th HTTPManager}
else begin
else
begin
if ProxySettings.password = EmptyWideStr then {password can be retrieved previously or just read from config}
begin
if mrOk = TAskPasswordForm.AskPassword(Format(ASK_PROXY_PASSWORD, [ProxySettings.User]), PREFIX_ASK_PROXY_PASSWORD, ProxySettings.password, ProxySettings.UseTCPasswordManager, False, FindTCWindow) then
Expand Down
2 changes: 1 addition & 1 deletion models/cipher/FileCipher.pas
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TFileCipher = class
function DecryptFile(SourceFileName, DestinationFilename: WideString): integer;
function DecryptStream(SourceStream, DestinationStream: TStream): integer;
function DecryptFileName(const FileName: WideString): WideString;
procedure DecryptDirListing(var CloudMailRuDirListing:TCMRDirItemList);
procedure DecryptDirListing(var CloudMailRuDirListing: TCMRDirItemList);

class function Base64ToSafe(const Base64: WideString): WideString; //converts Base64-encoded string to URL and Filename safe (RFC 4648)
class function Base64FromSafe(const Safe: WideString): WideString;
Expand Down
4 changes: 2 additions & 2 deletions models/http/CloudMailRuHTTP.pas
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ constructor TCloudMailRuHTTP.Create(Settings: TConnectionSettings; Progress: TTC
begin
self.Socks.Authentication := saUsernamePassword;
self.Socks.Username := Settings.ProxySettings.User;
self.Socks.password := Settings.ProxySettings.Password;
self.Socks.password := Settings.ProxySettings.password;
end
else
self.Socks.Authentication := saNoAuthentication;
Expand All @@ -141,7 +141,7 @@ constructor TCloudMailRuHTTP.Create(Settings: TConnectionSettings; Progress: TTC
begin
HTTP.ProxyParams.BasicAuthentication := true;
HTTP.ProxyParams.ProxyUsername := Settings.ProxySettings.User;
HTTP.ProxyParams.ProxyPassword := Settings.ProxySettings.Password;
HTTP.ProxyParams.ProxyPassword := Settings.ProxySettings.password;
end
end;

Expand Down
Loading

0 comments on commit b7bf2d6

Please sign in to comment.