Visitar URL original
ADD: param "postAction" of cm_AddToStash in Search Dialog · doublecmd/doublecmd@a5827ae · GitHub
Skip to content

Commit a5827ae

Browse files
committed
ADD: param "postAction" of cm_AddToStash in Search Dialog
1 parent ccb06ed commit a5827ae

1 file changed

Lines changed: 34 additions & 16 deletions

File tree

‎src/fFindDlg.pas‎

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ TfrmFindDlg = class(TModalForm, IFormCommands)
355355
procedure cm_Edit(const {%H-}Params: array of string);
356356
procedure cm_GoToFile(const {%H-}Params: array of string);
357357
procedure cm_FeedToListbox(const {%H-}Params: array of string);
358-
procedure cm_AddToStash(const {%H-}Params: array of string);
358+
procedure cm_AddToStash(const Params: array of string);
359359
procedure cm_PageNext(const Params: array of string);
360360
procedure cm_PagePrev(const Params: array of string);
361361
procedure cm_PageStandard(const {%H-}Params: array of string);
@@ -2125,8 +2125,7 @@ procedure TfrmFindDlg.cm_AddToStash(const Params: array of string);
21252125
var
21262126
oldCount: Integer;
21272127
newCount: Integer;
2128-
message: String;
2129-
ret: TModalResult;
2128+
postAction: String;
21302129

21312130
procedure openStash;
21322131
var
@@ -2140,27 +2139,46 @@ procedure TfrmFindDlg.cm_AddToStash(const Params: array of string);
21402139
frmMain.mnuOpenStashClick(self);
21412140
end;
21422141

2142+
function confirm: Boolean;
2143+
var
2144+
message: String;
2145+
ret: TModalResult;
2146+
begin
2147+
message:= Format( rsFindConfirmAfterAddtoStash,
2148+
[newCount-oldCount, rsStashName] );
2149+
ret:= MessageDlg(
2150+
message,
2151+
TMsgDlgType.mtConfirmation,
2152+
[mbYes, mbNo],
2153+
0,
2154+
mbYes );
2155+
Result:= (ret = mrYes);
2156+
end;
2157+
21432158
begin
21442159
StopSearch;
21452160

21462161
oldCount:= stashFilesBackend.count;
21472162
stashFilesBackend.addFromStringArray( lsFoundedFiles.Items.ToStringArray );
21482163
newCount:= stashFilesBackend.count;
2149-
if newCount <= oldCount then
2150-
Exit;
2164+
if oldCount > newCount then
2165+
oldCount:= newCount;
21512166

2152-
message:= Format( rsFindConfirmAfterAddtoStash,
2153-
[newCount-oldCount, rsStashName] );
2154-
ret:= MessageDlg(
2155-
message,
2156-
TMsgDlgType.mtConfirmation,
2157-
[mbYes, mbNo],
2158-
0,
2159-
mbYes );
2160-
if ret = mrNo then
2161-
Exit;
2167+
if NOT GetParamValue(Params, 'postAction', postAction) or postAction.IsEmpty then
2168+
postAction:= 'confirm';
2169+
2170+
case LowerCase(postAction) of
2171+
'confirm':
2172+
if confirm then
2173+
openStash
2174+
else
2175+
Exit;
2176+
'openstashwithoutconfirm':
2177+
openStash;
2178+
else
2179+
Exit;
2180+
end;
21622181

2163-
openStash;
21642182
self.Close;
21652183
end;
21662184

0 commit comments

Comments
 (0)