summaryrefslogtreecommitdiff
path: root/UConnectionProperties.pas
diff options
context:
space:
mode:
Diffstat (limited to 'UConnectionProperties.pas')
-rw-r--r--UConnectionProperties.pas228
1 files changed, 142 insertions, 86 deletions
diff --git a/UConnectionProperties.pas b/UConnectionProperties.pas
index a7dd921..689af4d 100644
--- a/UConnectionProperties.pas
+++ b/UConnectionProperties.pas
@@ -22,21 +22,21 @@ unit UConnectionProperties;
interface
uses
- SysUtils, Classes, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls, GTKConsts, GTKMenus;
+ SysUtils, Classes, lazgdk3, GTKControls, GTKForms, GTKStdCtrls, GTKExtCtrls;
type
TFConnectionProperties = class(TGTKDialog)
Label1, Label2, Label3, Label4, Label5, Label6, Label7, Label8, Label9: TGTKLabel;
Box: TGTKVBox;
- Table1, Table2: TGTKTable;
- PluginOptionMenu, ServiceTypeOptionMenu: TGTKOptionMenu;
+ Grid1, Grid2: TGTKGrid;
+ PluginComboBox, ServiceTypeComboBox: TGtkComboBoxText;
URIEntry, NameEntry, ServerEntry, UserNameEntry, PasswordEntry, TargetDirEntry: TGTKEntry;
MaskPasswordCheckButton: TGTKCheckButton;
procedure FormCreate(Sender: TObject); override;
procedure FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean);
procedure NameEntryChanged(Sender: TObject);
procedure URIEntryChanged(Sender: TObject);
- procedure ServiceTypeOptionMenuChanged(Sender: TObject);
+ procedure ServiceTypeComboBoxChanged(Sender: TObject);
procedure MaskPasswordCheckButtonToggled(Sender: TObject);
private
CurrentURI: string;
@@ -63,7 +63,7 @@ var ServiceTypeTable: array[1..ServiceTypeTable_Count, 0..1] of string;
procedure TFConnectionProperties.FormCreate(Sender: TObject);
var i: integer;
- MenuItem: TGTKMenuItem;
+ VBox: TGTKVBox;
begin
// Set the constants
ServiceTypeTable[1, 0] := LANGConnProp_FTP; ServiceTypeTable[1, 1] := 'ftp';
@@ -81,143 +81,199 @@ begin
Box.BorderWidth := 8;
ClientArea.AddControlEx(Box, True, True, 0);
Label1 := TGTKLabel.Create(Self);
- Label1.XAlign := 0;
- Label1.XPadding := 0;
Label1.Caption := LANGConnProp_VFSModule;
- PluginOptionMenu := TGTKOptionMenu.Create(Self);
- Label1.FocusControl := PluginOptionMenu;
+ PluginComboBox := TGtkComboBoxText.Create(Self);
+ PluginComboBox.MarginStart := 5;
+ PluginComboBox.MarginEnd := 5;
+ PluginComboBox.MarginTop := 2;
+ PluginComboBox.MarginBottom := 2;
+ Label1.FocusControl := PluginComboBox;
Label1.UseMarkup := True;
Label1.UseUnderline := True;
+ Label1.XAlign := 0;
+ Label1.MarginStart := 5;
+ Label1.MarginEnd := 5;
+ Label1.MarginTop := 2;
+ Label1.MarginBottom := 2;
Label2 := TGTKLabel.Create(Self);
- Label2.XAlign := 0;
- Label2.XPadding := 0;
Label2.Caption := Format('<span weight="ultrabold">%s</span>', [LANGConnProp_URI]);
URIEntry := TGTKEntry.Create(Self);
URIEntry.Tooltip := LANGConnProp_URIEntryTooltip;
+ URIEntry.MarginStart := 5;
+ URIEntry.MarginEnd := 5;
+ URIEntry.MarginTop := 2;
+ URIEntry.MarginBottom := 2;
Label2.FocusControl := URIEntry;
Label2.UseMarkup := True;
Label2.UseUnderline := True;
+ Label2.XAlign := 0;
+ Label2.MarginStart := 5;
+ Label2.MarginEnd := 5;
+ Label2.MarginTop := 2;
+ Label2.MarginBottom := 2;
Label3 := TGTKLabel.Create(Self);
- Label3.XAlign := 0;
- Label3.XPadding := 0;
Label3.Caption := Format('<span weight="ultrabold">%s</span>', [LANGConnProp_DetailedInformations]);
Label3.UseMarkup := True;
+ Label3.XAlign := 0;
+ Label3.MarginStart := 5;
+ Label3.MarginEnd := 5;
Label4 := TGTKLabel.Create(Self);
- Label4.XAlign := 0;
- Label4.XPadding := 0;
Label4.Caption := Format('<span weight="ultrabold">%s</span>', [LANGConnProp_Name]);
NameEntry := TGTKEntry.Create(Self);
+ NameEntry.MarginStart := 5;
+ NameEntry.MarginEnd := 5;
+ NameEntry.MarginTop := 2;
+ NameEntry.MarginBottom := 2;
Label4.FocusControl := NameEntry;
Label4.UseMarkup := True;
Label4.UseUnderline := True;
-
+ Label4.XAlign := 0;
+ Label4.MarginStart := 5;
+ Label4.MarginEnd := 5;
+ Label4.MarginTop := 2;
+ Label4.MarginBottom := 2;
Label5 := TGTKLabel.Create(Self);
- Label5.XAlign := 0;
- Label5.XPadding := 0;
Label5.Caption := LANGConnProp_Server;
ServerEntry := TGTKEntry.Create(Self);
+ ServerEntry.MarginStart := 5;
+ ServerEntry.MarginEnd := 5;
+ ServerEntry.MarginTop := 2;
+ ServerEntry.MarginBottom := 2;
Label5.FocusControl := ServerEntry;
Label5.UseMarkup := True;
Label5.UseUnderline := True;
+ Label5.XAlign := 0;
+ Label5.MarginStart := 5;
+ Label5.MarginEnd := 5;
+ Label5.MarginTop := 2;
+ Label5.MarginBottom := 2;
Label6 := TGTKLabel.Create(Self);
- Label6.XAlign := 0;
- Label6.XPadding := 0;
Label6.Caption := LANGConnProp_Username;
UserNameEntry := TGTKEntry.Create(Self);
UserNameEntry.Tooltip := LANGConnProp_UserNameEntryTooltip;
+ UserNameEntry.MarginStart := 5;
+ UserNameEntry.MarginEnd := 5;
+ UserNameEntry.MarginTop := 2;
+ UserNameEntry.MarginBottom := 2;
Label6.FocusControl := UserNameEntry;
Label6.UseMarkup := True;
Label6.UseUnderline := True;
+ Label6.XAlign := 0;
+ Label6.MarginStart := 5;
+ Label6.MarginEnd := 5;
+ Label6.MarginTop := 2;
+ Label6.MarginBottom := 2;
Label7 := TGTKLabel.Create(Self);
- Label7.XAlign := 0;
- Label7.XPadding := 0;
Label7.Caption := LANGConnProp_Password;
PasswordEntry := TGTKEntry.Create(Self);
PasswordEntry.Visibility := False;
+ PasswordEntry.MarginStart := 5;
+ PasswordEntry.MarginEnd := 5;
+ PasswordEntry.MarginTop := 2;
+ PasswordEntry.MarginBottom := 2;
Label7.FocusControl := PasswordEntry;
Label7.UseMarkup := True;
Label7.UseUnderline := True;
+ Label7.XAlign := 0;
+ Label7.MarginStart := 5;
+ Label7.MarginEnd := 5;
+ Label7.MarginTop := 2;
+ Label7.MarginBottom := 2;
Label8 := TGTKLabel.Create(Self);
- Label8.XAlign := 0;
- Label8.XPadding := 0;
Label8.Caption := LANGConnProp_TargetDirectory;
TargetDirEntry := TGTKEntry.Create(Self);
+ TargetDirEntry.MarginStart := 5;
+ TargetDirEntry.MarginEnd := 5;
+ TargetDirEntry.MarginTop := 2;
+ TargetDirEntry.MarginBottom := 2;
Label8.FocusControl := TargetDirEntry;
Label8.UseMarkup := True;
Label8.UseUnderline := True;
+ Label8.XAlign := 0;
+ Label8.MarginStart := 5;
+ Label8.MarginEnd := 5;
+ Label8.MarginTop := 2;
+ Label8.MarginBottom := 2;
Label9 := TGTKLabel.Create(Self);
- Label9.XAlign := 0;
- Label9.XPadding := 0;
Label9.Caption := LANGConnProp_ServiceType;
- ServiceTypeOptionMenu := TGTKOptionMenu.Create(Self);
- Label9.FocusControl := PluginOptionMenu;
+ Label9.XAlign := 0;
+ Label9.MarginStart := 5;
+ Label9.MarginEnd := 5;
+ Label9.MarginTop := 2;
+ Label9.MarginBottom := 2;
+ ServiceTypeComboBox := TGtkComboBoxText.Create(Self);
+ ServiceTypeComboBox.MarginStart := 5;
+ ServiceTypeComboBox.MarginEnd := 5;
+ ServiceTypeComboBox.MarginTop := 2;
+ ServiceTypeComboBox.MarginBottom := 2;
+ Label9.FocusControl := PluginComboBox;
Label9.UseMarkup := True;
Label9.UseUnderline := True;
MaskPasswordCheckButton := TGTKCheckButton.CreateWithLabel(Self, LANGConnProp_MaskPassword);
MaskPasswordCheckButton.Checked := True;
-
- Table1 := TGTKTable.Create(Self);
- Box.AddControlEx(Table1, True, True, 5);
- Table1.AddControlEx(0, 0, 1, 1, Label4, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table1.AddControlEx(1, 0, 1, 1, NameEntry, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table1.AddControlEx(0, 1, 1, 1, Label2, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table1.AddControlEx(1, 1, 1, 1, URIEntry, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table1.AddControlEx(0, 2, 1, 1, Label1, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table1.AddControlEx(1, 2, 1, 1, PluginOptionMenu, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table1.AddControlEx(0, 3, 2, 1, TGTKVBox.Create(Self), [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 10);
- Table1.AddControlEx(0, 4, 2, 1, Label3, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 0);
-
-
- Table2 := TGTKTable.Create(Self);
- Box.AddControlEx(Table2, True, True, 5);
- Table2.AddControlEx(0, 0, 1, 1, TGTKHBox.Create(Self), [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 10, 2);
- Table2.AddControlEx(1, 0, 1, 1, Label9, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(2, 0, 1, 1, ServiceTypeOptionMenu, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(1, 1, 1, 1, Label5, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(2, 1, 1, 1, ServerEntry, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(1, 2, 1, 1, Label6, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(2, 2, 1, 1, UserNameEntry, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(1, 3, 1, 1, Label7, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(2, 3, 1, 1, PasswordEntry, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(2, 4, 1, 1, MaskPasswordCheckButton, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 0);
- Table2.AddControlEx(1, 5, 1, 1, Label8, [taoShrink, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
- Table2.AddControlEx(2, 5, 1, 1, TargetDirEntry, [taoExpand, taoFill], [taoShrink, taoExpand, taoFill], 5, 2);
-
+ MaskPasswordCheckButton.MarginStart := 5;
+ MaskPasswordCheckButton.MarginEnd := 5;
+
+ Grid1 := TGTKGrid.Create(Self);
+ Box.AddControlEx(Grid1, True, True, 5);
+ Grid1.AddControl(0, 0, 1, 1, Label4);
+ Grid1.AddControl(1, 0, 1, 1, NameEntry);
+ Grid1.AddControl(0, 1, 1, 1, Label2);
+ Grid1.AddControl(1, 1, 1, 1, URIEntry);
+ Grid1.AddControl(0, 2, 1, 1, Label1);
+ Grid1.AddControl(1, 2, 1, 1, PluginComboBox);
+ VBox := TGTKVBox.Create(Self);
+ VBox.MarginStart := 5;
+ VBox.MarginEnd := 5;
+ VBox.MarginTop := 10;
+ VBox.MarginBottom := 10;
+ Grid1.AddControl(0, 3, 2, 1, VBox);
+ Grid1.AddControl(0, 4, 2, 1, Label3);
+
+
+ Grid2 := TGTKGrid.Create(Self);
+ Box.AddControlEx(Grid2, True, True, 5);
+ VBox := TGTKVBox.Create(Self);
+ VBox.MarginStart := 10;
+ VBox.MarginEnd := 10;
+ VBox.MarginTop := 2;
+ VBox.MarginBottom := 2;
+ Grid2.AddControl(0, 0, 1, 1, VBox);
+ Grid2.AddControl(1, 0, 1, 1, Label9);
+ Grid2.AddControl(2, 0, 1, 1, ServiceTypeComboBox);
+ Grid2.AddControl(1, 1, 1, 1, Label5);
+ Grid2.AddControl(2, 1, 1, 1, ServerEntry);
+ Grid2.AddControl(1, 2, 1, 1, Label6);
+ Grid2.AddControl(2, 2, 1, 1, UserNameEntry);
+ Grid2.AddControl(1, 3, 1, 1, Label7);
+ Grid2.AddControl(2, 3, 1, 1, PasswordEntry);
+ Grid2.AddControl(2, 4, 1, 1, MaskPasswordCheckButton);
+ Grid2.AddControl(1, 5, 1, 1, Label8);
+ Grid2.AddControl(2, 5, 1, 1, TargetDirEntry);
// Fill the plugins menu
- MenuItem := TGTKMenuItem.CreateTyped(Self, itLabel);
- MenuItem.Caption := LANGConnProp_MenuItemCaption;
- PluginOptionMenu.Items.Add(MenuItem);
+ PluginComboBox.AppendItem(LANGConnProp_MenuItemCaption);
for i := 0 to PluginList.Count - 1 do
- if TVFSPlugin(PluginList[i]).HandlesNetwork then begin
- MenuItem := TGTKMenuItem.CreateTyped(Self, itImageText);
- MenuItem.Data := PluginList[i];
- MenuItem.SetCaptionPlain(Format('%s [%s]', [TVFSPlugin(PluginList[i]).ModuleName,
- ExtractFileName(TVFSPlugin(PluginList[i]).FullModulePath)]));
- PluginOptionMenu.Items.Add(MenuItem);
- end;
-
+ if TVFSPlugin(PluginList[i]).HandlesNetwork then
+ PluginComboBox.AppendItemID(TVFSPlugin(PluginList[i]).ModuleID,
+ Format('%s [%s]', [TVFSPlugin(PluginList[i]).ModuleName,
+ ExtractFileName(TVFSPlugin(PluginList[i]).FullModulePath)]));
// Fill the protocol menu
- for i := 1 to ServiceTypeTable_Count do begin
- MenuItem := TGTKMenuItem.CreateTyped(Self, itImageText);
- MenuItem.Caption := ServiceTypeTable[i, 0];
- ServiceTypeOptionMenu.Items.Add(MenuItem);
- end;
-
+ for i := 1 to ServiceTypeTable_Count do
+ ServiceTypeComboBox.AppendItem(ServiceTypeTable[i, 0]);
Lock := True;
OnKeyDown := @FormKeyDown;
NameEntry.OnChanged := @NameEntryChanged;
URIEntry.OnChanged := @URIEntryChanged;
- ServiceTypeOptionMenu.OnChanged := @ServiceTypeOptionMenuChanged;
- ServerEntry.OnChanged := @ServiceTypeOptionMenuChanged;
- UserNameEntry.OnChanged := @ServiceTypeOptionMenuChanged;
- PasswordEntry.OnChanged := @ServiceTypeOptionMenuChanged;
- TargetDirEntry.OnChanged := @ServiceTypeOptionMenuChanged;
+ ServiceTypeComboBox.OnChanged := @ServiceTypeComboBoxChanged;
+ ServerEntry.OnChanged := @ServiceTypeComboBoxChanged;
+ UserNameEntry.OnChanged := @ServiceTypeComboBoxChanged;
+ PasswordEntry.OnChanged := @ServiceTypeComboBoxChanged;
+ TargetDirEntry.OnChanged := @ServiceTypeComboBoxChanged;
MaskPasswordCheckButton.OnToggled := @MaskPasswordCheckButtonToggled;
-
NameEntry.SetFocus;
NameEntryChanged(Self);
Lock := False;
@@ -226,15 +282,15 @@ end;
procedure TFConnectionProperties.FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean);
begin
case Key of
- GDK_RETURN, GDK_KP_ENTER: if ValidSettings then ModalResult := mbOK;
- GDK_ESCAPE: ModalResult := mbCancel;
+ GDK_KEY_Return, GDK_KEY_KP_Enter: if ValidSettings then ModalResult := mbOK;
+ GDK_KEY_Escape: ModalResult := mbCancel;
end;
end;
procedure TFConnectionProperties.MaskPasswordCheckButtonToggled(Sender: TObject);
begin
PasswordEntry.Visibility := not MaskPasswordCheckButton.Checked;
- ServiceTypeOptionMenuChanged(Self);
+ ServiceTypeComboBoxChanged(Self);
end;
(********************************************************************************************************************************)
@@ -267,7 +323,7 @@ begin
j := i;
Break;
end;
- ServiceTypeOptionMenu.ItemIndex := j - 1;
+ ServiceTypeComboBox.ItemIndex := j - 1;
Delete(s2, 1, Pos('://', s2) + 2);
end;
@@ -304,7 +360,7 @@ begin
Result := ConstructURI(True, Hidden, GetService, ServerEntry.Text, UserNameEntry.Text, PasswordEntry.Text, TargetDirEntry.Text);
end;
-procedure TFConnectionProperties.ServiceTypeOptionMenuChanged(Sender: TObject);
+procedure TFConnectionProperties.ServiceTypeComboBoxChanged(Sender: TObject);
begin
if Lock then Exit;
CurrentURI := MakeURI(False);
@@ -317,8 +373,8 @@ end;
function TFConnectionProperties.GetService: string;
begin
Result := ServiceTypeTable[ServiceTypeTable_Count, 1];
- if ServiceTypeOptionMenu.ItemIndex < ServiceTypeTable_Count - 1
- then Result := ServiceTypeTable[ServiceTypeOptionMenu.ItemIndex + 1, 1] else
+ if ServiceTypeComboBox.ItemIndex < ServiceTypeTable_Count - 1
+ then Result := ServiceTypeTable[ServiceTypeComboBox.ItemIndex + 1, 1] else
if Pos('://', URIEntry.Text) > 1 then Result := Copy(URIEntry.Text, 1, Pos('://', URIEntry.Text) - 1);
end;