diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-07-25 13:32:37 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-07-25 13:32:37 +0200 |
commit | ca9a8de1df0690a1ee86ce39c3e6f3bc7d381c8b (patch) | |
tree | 7a075b44f2b05e06e90e755ef49641c74c1fe3ef /docview | |
parent | f54c9412f15f0fe95d5da464fc077b72d5435c04 (diff) | |
download | fpGUI-ca9a8de1df0690a1ee86ce39c3e6f3bc7d381c8b.tar.xz |
docview: 1st parameter handling improvement
We now try and detect if a valid filename was passed as the first parameter.
If not (eg: some other -XXX parameter) then we simply ignore it.
Diffstat (limited to 'docview')
-rw-r--r-- | docview/src/frm_main.pas | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/docview/src/frm_main.pas b/docview/src/frm_main.pas index 6acb2f79..e3617bd3 100644 --- a/docview/src/frm_main.pas +++ b/docview/src/frm_main.pas @@ -3350,16 +3350,16 @@ begin // do nothing else begin -//writeln('DEBUG: TMainForm.ProcessCommandLineParams - Open file...'); showtopic := not gCommandLineParams.IsParam('k'); - OpenFile(ParamStr(1), '', showtopic); + { is the first parameter a known docview help, or some addition parameter } + if Pos(ctiCommandLineParamPrefix, ParamStr(1)) = 0 then + OpenFile(ParamStr(1), '', showtopic); end; end; // now process all other parameters if gCommandLineParams.IsParam('k') then begin -//writeln('DEBUG: TMainForm.ProcessCommandLineParams - Keyword Search string'); { Search for a string } edSearchText.Text := gCommandLineParams.GetParam('k'); PageControl1.ActivePage := tsSearch; @@ -3368,19 +3368,13 @@ begin else if gCommandLineParams.IsParam('n') then begin { Display topic with numeric topic id } -//writeln('DEBUG: TMainForm.ProcessCommandLineParams - Display numeric topic id'); t := FindTopicByResourceID(StrToInt(gCommandLineParams.GetParam('n'))); -//if not Assigned(t) then -// writeln(Format('Failed to find topic <%s>', [gCommandLineParams.GetParam('n')])); DisplayTopic(t); end else if gCommandLineParams.IsParam('s') then begin -//writeln('DEBUG: TMainForm.ProcessCommandLineParams - display string topic id'); { Display topic with string topic id } t := FindTopicByName(gCommandLineParams.GetParam('s')); -//if not Assigned(t) then -// writeln(Format('Failed to find topic <%s>', [gCommandLineParams.GetParam('k')])); DisplayTopic(t); end; end; |