mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-15 16:02:40 +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);
|
// example: RegisterContentProvider('chm://', TChmContentProvider);
|
||||||
|
|
||||||
function GetContentProvider(const Protocol: String): TBaseContentProviderClass;
|
function GetContentProvider(const Protocol: String): TBaseContentProviderClass;
|
||||||
|
|
||||||
|
// Result must be freed by caller
|
||||||
|
function GetContentProviderList: TStringList;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -62,6 +66,12 @@ begin
|
|||||||
Result := TBaseContentProviderClass(ContentProviders.Objects[fIndex]);
|
Result := TBaseContentProviderClass(ContentProviders.Objects[fIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetContentProviderList: TStringList;
|
||||||
|
begin
|
||||||
|
Result := TStringList.Create;
|
||||||
|
Result.AddStrings(ContentProviders);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ TBaseContentProvider }
|
{ TBaseContentProvider }
|
||||||
|
@ -180,7 +180,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
TCHMHack(fChms).OpenNewFile(AFile);
|
TCHMHack(fChms).OpenNewFile(AFile);
|
||||||
WriteLn('Loading new chm: ', AFile);
|
//WriteLn('Loading new chm: ', AFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if fChms = nil then Exit;
|
if fChms = nil then Exit;
|
||||||
|
@ -154,8 +154,25 @@ end;
|
|||||||
procedure THelpForm.FileMenuOpenURLItemClick(Sender: TObject);
|
procedure THelpForm.FileMenuOpenURLItemClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
fRes: String;
|
fRes: String;
|
||||||
|
URLSAllowed: String;
|
||||||
|
Protocall: TStrings;
|
||||||
|
i: Integer;
|
||||||
begin
|
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
|
begin
|
||||||
OpenURL(fRes);
|
OpenURL(fRes);
|
||||||
RefreshState;
|
RefreshState;
|
||||||
|
Loading…
Reference in New Issue
Block a user