From f35af507573469b7c1692f01922d323bd1000fbc Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 12 Oct 2008 15:50:20 +0200 Subject: Connection Manager password callback improvements --- UConnectionProperties.pas | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'UConnectionProperties.pas') diff --git a/UConnectionProperties.pas b/UConnectionProperties.pas index 27d5bbe..99dbf9a 100644 --- a/UConnectionProperties.pas +++ b/UConnectionProperties.pas @@ -44,6 +44,7 @@ type function ValidSettings: boolean; public function MakeURI(Hidden: boolean): string; + function GetService: string; end; var @@ -297,25 +298,8 @@ begin end; function TFConnectionProperties.MakeURI(Hidden: boolean): string; -var Prefix: string; begin - Prefix := ServiceTypeTable[ServiceTypeTable_Count, 1]; - if ServiceTypeOptionMenu.ItemIndex < ServiceTypeTable_Count - 1 - then Prefix := ServiceTypeTable[ServiceTypeOptionMenu.ItemIndex + 1, 1] else - if Pos('://', URIEntry.Text) > 1 then Prefix := Copy(URIEntry.Text, 1, Pos('://', URIEntry.Text) - 1); - Result := Prefix + '://'; - if Length(UserNameEntry.Text) > 0 then begin - Result := Result + UserNameEntry.Text; - if Length(PasswordEntry.Text) > 0 then - if Hidden then Result := Result + ':' + StringOfChar('*', Length(PasswordEntry.Text)) - else Result := Result + ':' + PasswordEntry.Text; - Result := Result + '@'; - end; - Result := Result + ServerEntry.Text; - if Length(TargetDirEntry.Text) > 0 then begin - if TargetDirEntry.Text[1] <> '/' then Result := Result + '/'; - Result := Result + TargetDirEntry.Text; - end; + Result := ConstructURI(True, Hidden, GetService, ServerEntry.Text, UserNameEntry.Text, PasswordEntry.Text, TargetDirEntry.Text); end; procedure TFConnectionProperties.ServiceTypeOptionMenuChanged(Sender: TObject); @@ -328,6 +312,14 @@ begin NameEntryChanged(Sender); 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 Pos('://', URIEntry.Text) > 1 then Result := Copy(URIEntry.Text, 1, Pos('://', URIEntry.Text) - 1); +end; + end. -- cgit v1.2.3