UPD: Change cm_AddToQueue parameter to a form of "queueid=x".

This commit is contained in:
cobines 2012-04-01 06:18:42 +00:00
commit 81a01a5b8c
2 changed files with 24 additions and 1 deletions

View file

@ -124,8 +124,9 @@ end;
procedure TfrmCopyDlg.cm_AddToQueue(const Params: array of String);
var
Value: Integer;
sQueueId: String;
begin
if (Length(Params) > 0) and TryStrToInt(Params[0], Value) then
if GetParamValue(Params, 'queueid', sQueueId) and TryStrToInt(sQueueId, Value) then
FQueueIdentifier := Value
else
FQueueIdentifier := SingleQueueId;

View file

@ -135,6 +135,13 @@ type
end;
function GetDefaultParam(const Params: array of String): String;
{en
Searches for parameters starting with "Key=" and sets Value to the
the rest of the parameter string (Key=Value).
If the key is not found it sets Value to empty string and returns @false.
@returns(@true if the key was found, @false if it was not found)
}
function GetParamValue(const Params: array of String; Key: String; out Value: String): Boolean;
implementation
@ -352,5 +359,20 @@ begin
Result := '';
end;
function GetParamValue(const Params: array of String; Key: String; out Value: String): Boolean;
var
Param: String;
begin
Key := Key + '=';
for Param in Params do
if StrBegins(Param, Key) then
begin
Value := Copy(Param, Length(Key) + 1, MaxInt);
Exit(True);
end;
Value := '';
Result := False;
end;
end.