mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-15 07:42:52 +02:00
Made OpenURL dialog more user friendly
git-svn-id: trunk@20622 -
This commit is contained in:
parent
00e3b0160c
commit
e0673a43bf
@ -38,6 +38,10 @@ type
|
||||
// example: RegisterContentProvider('chm://', TChmContentProvider);
|
||||
|
||||
function GetContentProvider(const Protocol: String): TBaseContentProviderClass;
|
||||
|
||||
// Result must be freed by caller
|
||||
function GetContentProviderList: TStringList;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
@ -62,6 +66,12 @@ begin
|
||||
Result := TBaseContentProviderClass(ContentProviders.Objects[fIndex]);
|
||||
end;
|
||||
|
||||
function GetContentProviderList: TStringList;
|
||||
begin
|
||||
Result := TStringList.Create;
|
||||
Result.AddStrings(ContentProviders);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{ TBaseContentProvider }
|
||||
|
@ -180,7 +180,7 @@ begin
|
||||
else
|
||||
begin
|
||||
TCHMHack(fChms).OpenNewFile(AFile);
|
||||
WriteLn('Loading new chm: ', AFile);
|
||||
//WriteLn('Loading new chm: ', AFile);
|
||||
end;
|
||||
|
||||
if fChms = nil then Exit;
|
||||
|
@ -154,8 +154,25 @@ end;
|
||||
procedure THelpForm.FileMenuOpenURLItemClick(Sender: TObject);
|
||||
var
|
||||
fRes: String;
|
||||
URLSAllowed: String;
|
||||
Protocall: TStrings;
|
||||
i: Integer;
|
||||
begin
|
||||
if InputQuery('Enter a URL', 'Please Enter a URL', fRes) then
|
||||
Protocall := GetContentProviderList;
|
||||
|
||||
for i := 0 to Protocall.Count-1 do
|
||||
begin
|
||||
if i < 1 then
|
||||
URLSAllowed := URLSAllowed + Protocall[i]
|
||||
else
|
||||
URLSAllowed := URLSAllowed + ', ' +Protocall[i]
|
||||
end;
|
||||
Protocall.Free;
|
||||
|
||||
URLSAllowed := Trim(URLSALLowed);
|
||||
|
||||
|
||||
if InputQuery('Please Enter a URL', 'Supported URL type(s): (' +URLSAllowed+ ')', fRes) then
|
||||
begin
|
||||
OpenURL(fRes);
|
||||
RefreshState;
|
||||
|
Loading…
Reference in New Issue
Block a user