diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-08-06 18:52:00 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2010-08-06 18:52:00 +0200 |
commit | 579a1ee09ed495680d944faf59a1f3de696fe882 (patch) | |
tree | bfe87dcf316ff4b5302a77a0fe12682a49460a4c | |
parent | 5e64e5f73ac8b7489340dc503bc33fdbe350f8be (diff) | |
download | fpGUI-579a1ee09ed495680d944faf59a1f3de696fe882.tar.xz |
docview: implemented external link click support.
When end-user clicks on a external link (http, ftp, mailto),
then fpgOpenURL() is called.
-rw-r--r-- | docview/src/frm_main.pas | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas index bc3ccece..04873d1f 100644 --- a/docview/src/frm_main.pas +++ b/docview/src/frm_main.pas @@ -267,9 +267,21 @@ var i: integer; lTopic: TTopic; lFound: Boolean; + lURL: TfpgString; begin // TODO: process other types of links (external, application etc...) too! - + if pos('url', Link) > 0 then + begin + // we have a external URL of some kind + // format is always: 'url "<uri>"' +// ShowMessage('Found an external Link' + LineEnding + Link); + lURL := StringReplace(Link, 'url "', '', []); + lURL := UTF8Copy(lURL, 0, UTF8Length(lURL)-1); + fpgOpenURL(lURL); + end + else + begin + // we have a internal INF file link LinkIndex := StrToInt( Link ); lLink := THelpLink(CurrentTopic.Links[LinkIndex]); lTopic := FindTopicForLink(lLink); @@ -287,25 +299,18 @@ begin if lTopic <> nil then begin lFound := True; - writeln('Found Topic! ', lTopic.Title); +// writeln('Found Topic! ', lTopic.Title); break; - end; if lFound then break; end; if lTopic <> nil then begin - writeln('Displaying topic <', lTopic.Title, '>'); +// writeln('Displaying topic <', lTopic.Title, '>'); DisplayTopic(lTopic); end; - //lLink := SourceWindow.Topic.Links[ LinkIndex ]; - // - //PostMsg( Self.Handle, - // WM_FOLLOWLINK, - // longint( Link ), - // longint( SourceWindow ) ); - + end; end; procedure TMainForm.IndexSearchEditKeyPress(Sender: TObject; var KeyCode: word; |