View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000559 | Double Commander | Logic | public | 2012-09-08 21:52 | 2014-01-14 09:02 |
| Reporter | pktfag | Assigned To | Alexx2000 | ||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Projection | none | ETA | none | ||
| Fixed in Version | 0.5.5 | ||||
| Summary | 0000559: Search in the selected files and directories | ||||
| Description | Very handy feature in totalcmd: search the selected files and directories. I made the patch: findsel.patch | ||||
| Tags | No tags attached. | ||||
| Attached Files | findsel.patch (11,289 bytes)
Index: language/doublecmd.po
===================================================================
--- language/doublecmd.po (revision 4952)
+++ language/doublecmd.po (working copy)
@@ -1864,6 +1864,10 @@
msgid "Re&place by"
msgstr ""
+#: tfrmfinddlg.cbselectedfiles.caption
+msgid "Selected directories and &files"
+msgstr ""
+
#: tfrmfinddlg.cbtimefrom.caption
msgid "Time from:"
msgstr ""
Index: language/doublecmd.ru.po
===================================================================
--- language/doublecmd.ru.po (revision 4952)
+++ language/doublecmd.ru.po (working copy)
@@ -1890,6 +1890,10 @@
msgid "Re&place by"
msgstr "Заменить текст"
+#: tfrmfinddlg.cbselectedfiles.caption
+msgid "Selected directories and &files"
+msgstr "&Выбранные файлы и каталоги"
+
#: tfrmfinddlg.cbtimefrom.caption
msgid "Time from:"
msgstr "Время от:"
Index: src/fFindDlg.lfm
===================================================================
--- src/fFindDlg.lfm (revision 4952)
+++ src/fFindDlg.lfm (working copy)
@@ -170,6 +170,20 @@
TabOrder = 0
end
end
+ object cbSelectedFiles: TCheckBox
+ AnchorSideTop.Side = asrBottom
+ AnchorSideRight.Control = cbFollowSymLinks
+ AnchorSideBottom.Control = cbFollowSymLinks
+ AnchorSideBottom.Side = asrBottom
+ Left = 428
+ Height = 19
+ Top = 0
+ Width = 169
+ Anchors = [akRight, akBottom]
+ Caption = 'Selected directories and &files'
+ OnChange = cbSelectedFilesChange
+ TabOrder = 4
+ end
end
object gbFiles: TGroupBox
AnchorSideLeft.Control = tsStandard
Index: src/fFindDlg.lrt
===================================================================
--- src/fFindDlg.lrt (revision 4952)
+++ src/fFindDlg.lrt (working copy)
@@ -6,6 +6,7 @@
TFRMFINDDLG.LBLEXCLUDEDIRECTORIES.CAPTION=E&xclude subdirectories
TFRMFINDDLG.CMBEXCLUDEDIRECTORIES.HINT=Enter directories names that should be excluded from search separated with ";"
TFRMFINDDLG.LBLSEARCHDEPTH.CAPTION=Search su&bdirectories:
+TFRMFINDDLG.CBSELECTEDFILES.CAPTION=Selected directories and &files
TFRMFINDDLG.GBFILES.CAPTION=Files
TFRMFINDDLG.LBLFINDFILEMASK.CAPTION=&File mask
TFRMFINDDLG.CMBFINDFILEMASK.HINT=Enter files names separated with ";"
Index: src/fFindDlg.pas
===================================================================
--- src/fFindDlg.pas (revision 4952)
+++ src/fFindDlg.pas (working copy)
@@ -33,7 +33,7 @@
Graphics, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, ComCtrls,
ExtCtrls, Menus, EditBtn, Spin, Buttons, ZVDateTimePicker, KASComboBox,
fAttributesEdit, uDsxModule, DsxPlugin, uFindThread, uFindFiles,
- uSearchTemplate;
+ uSearchTemplate, uFileView;
type
@@ -71,6 +71,7 @@
cbPartialNameSearch: TCheckBox;
cbFollowSymLinks: TCheckBox;
cbUsePlugin: TCheckBox;
+ cbSelectedFiles: TCheckBox;
cmbExcludeDirectories: TComboBoxWithDelItems;
cmbNotOlderThanUnit: TComboBox;
cmbFileSizeUnit: TComboBox;
@@ -142,6 +143,7 @@
procedure cbDateToChange(Sender: TObject);
procedure cbPartialNameSearchChange(Sender: TObject);
procedure cbRegExpChange(Sender: TObject);
+ procedure cbSelectedFilesChange(Sender: TObject);
procedure cmbEncodingSelect(Sender: TObject);
procedure cbFindTextChange(Sender: TObject);
procedure cbUsePluginChange(Sender: TObject);
@@ -185,6 +187,9 @@
procedure ZVTimeFromChange(Sender: TObject);
procedure ZVTimeToChange(Sender: TObject);
private
+ FFileView: TFileView;
+ FSelectedFiles: TStringList;
+
FFindThread:TFindThread;
DsxPlugins: TDSXModuleList;
FSearchingActive: Boolean;
@@ -218,7 +223,7 @@
var
FoundedStringCopy: TStringlist = nil;
-procedure ShowFindDlg(const sActPath: UTF8String);
+procedure ShowFindDlg(FileView: TFileView);
function ShowDefineTemplateDlg(var TemplateName: UTF8String): Boolean;
function ShowUseTemplateDlg(var Template: TSearchTemplate): Boolean;
@@ -230,7 +235,7 @@
LCLProc, LCLType, LConvEncoding, StrUtils, HelpIntfs, fViewer, fMain,
uLng, uGlobs, uShowForm, uDCUtils,
uSearchResultFileSource, uFile, uFileSystemFileSource,
- uFileViewNotebook, uFileView, uColumnsFileView, uKeyboard,
+ uFileViewNotebook, uColumnsFileView, uKeyboard,
DCOSUtils;
const
@@ -271,14 +276,15 @@
Application.ProcessMessages;
end;
-procedure ShowFindDlg(const sActPath: UTF8String);
+procedure ShowFindDlg(FileView: TFileView);
begin
with TfrmFindDlg.Instance do
begin
// Prepare window for search files
ClearFilter;
+ FFileView := FileView;
Caption := rsFindSearchFiles;
- edtFindPathStart.Text := sActPath;
+ edtFindPathStart.Text := FileView.CurrentPath;
ShowOnTop;
end;
end;
@@ -417,6 +423,8 @@
edtFindPathStart.ShowHidden := gShowSystemFiles;
cbPartialNameSearch.Checked:= gPartialNameSearch;
+ FSelectedFiles := TStringList.Create;
+
InitPropStorage(Self);
end;
@@ -449,6 +457,7 @@
destructor TfrmFindDlg.Destroy;
begin
inherited Destroy;
+ FSelectedFiles.Free;
FLastSearchTemplate.Free;
end;
@@ -602,6 +611,11 @@
if cbRegExp.Checked then cbPartialNameSearch.Checked:=False;
end;
+procedure TfrmFindDlg.cbSelectedFilesChange(Sender: TObject);
+begin
+ edtFindPathStart.Enabled := not cbSelectedFiles.Checked;
+end;
+
procedure TfrmFindDlg.btnSelDirClick(Sender: TObject);
var
s:String;
@@ -809,6 +823,7 @@
sPath : UTF8String;
sr: TDsxSearchRecord;
SearchTemplate, TmpTemplate: TSearchTemplateRec;
+ I: Integer;
begin
sTemp:= edtFindPathStart.Text;
repeat
@@ -866,6 +881,16 @@
TmpTemplate.StartPath := ''; // Don't remember starting path.
FLastSearchTemplate.SearchRecord := TmpTemplate;
+ FSelectedFiles.Clear;
+ if cbSelectedFiles.Checked then begin
+ for I := 0 to FFileView.DisplayFiles.Count - 1 do begin
+ if FFileView.DisplayFiles[i].Selected then begin
+ sTemp := FFileView.DisplayFiles[I].FSFile.FullPath;
+ FSelectedFiles.Add(sTemp);
+ end;
+ end;
+ end;
+
try
if (cbUsePlugin.Checked) and (cmbPlugin.ItemIndex<>-1) then
begin
@@ -880,7 +905,7 @@
end
else
begin
- FFindThread := TFindThread.Create(SearchTemplate);
+ FFindThread := TFindThread.Create(SearchTemplate, FSelectedFiles);
with FFindThread do
begin
Items := FoundedStringCopy;
@@ -1109,6 +1134,9 @@
if pgcSearch.ActivePage = tsStandard then
if cmbFindFileMask.CanFocus then
cmbFindFileMask.SetFocus;
+
+ cbSelectedFiles.Checked := FFileView.HasSelectedFiles;
+ cbSelectedFiles.Enabled := FFileView.HasSelectedFiles;
end;
procedure TfrmFindDlg.gbDirectoriesResize(Sender: TObject);
Index: src/ufindthread.pas
===================================================================
--- src/ufindthread.pas (revision 4952)
+++ src/ufindthread.pas (working copy)
@@ -47,6 +47,7 @@
FFoundFile:String;
FCurrentDepth: Integer;
FSearchTemplate: TSearchTemplateRec;
+ FSelectedFiles: TStringList;
FFileChecks: TFindFileChecks;
FLinkTargets: TStringList; // A list of encountered directories (for detecting cycles)
@@ -57,9 +58,10 @@
protected
procedure Execute; override;
public
- constructor Create(const AFindOptions: TSearchTemplateRec);
+ constructor Create(const AFindOptions: TSearchTemplateRec; SelectedFiles: TStringList);
destructor Destroy; override;
procedure AddFile;
+ procedure DoFile(const sNewDir:String; const sr : TSearchRecEx);
procedure WalkAdr(const sNewDir:String);
procedure UpDateProgress;
function IsAborting: Boolean;
@@ -79,12 +81,13 @@
{ TFindThread }
-constructor TFindThread.Create(const AFindOptions: TSearchTemplateRec);
+constructor TFindThread.Create(const AFindOptions: TSearchTemplateRec; SelectedFiles: TStringList);
begin
inherited Create(True);
FLinkTargets := TStringList.Create;
FSearchTemplate := AFindOptions;
+ FSelectedFiles := SelectedFiles;
with FSearchTemplate do
begin
@@ -114,6 +117,7 @@
procedure TFindThread.Execute;
var
sTemp, sPath: UTF8String;
+ I: Integer;
begin
FreeOnTerminate := True;
@@ -121,15 +125,24 @@
Assert(Assigned(FItems),'assert:FItems is empty');
Synchronize(@UpDateProgress);
FCurrentDepth:= -1;
- sTemp:= FSearchTemplate.StartPath;
- while sTemp <> EmptyStr do
+ if FSelectedFiles.Count = 0 then
+ begin
+ sTemp:= FSearchTemplate.StartPath;
+ while sTemp <> EmptyStr do
+ begin
+ sPath:= Copy2SymbDel(sTemp, ';');
+ sPath:= ExcludeBackPathDelimiter(sPath);
+ WalkAdr(sPath);
+ end;
+ FCurrentDir:= rsOperFinished;
+ Synchronize(@UpDateProgress);
+ end else
+ begin
+ for I := 0 to FSelectedFiles.Count - 1 do
begin
- sPath:= Copy2SymbDel(sTemp, ';');
- sPath:= ExcludeBackPathDelimiter(sPath);
- WalkAdr(sPath);
+ WalkAdr(FSelectedFiles[I]);
end;
- FCurrentDir:= rsOperFinished;
- Synchronize(@UpDateProgress);
+ end;
except
on E:Exception do
msgError(Self, E.Message);
@@ -327,6 +340,19 @@
end;
end;
+procedure TFindThread.DoFile(const sNewDir:String; const sr : TSearchRecEx);
+begin
+ if CheckFile(sNewDir, sr) then
+ begin
+ FFoundFile := sNewDir + PathDelim + sr.Name;
+ Synchronize(@AddFile);
+ Inc(FFilesFound);
+ end;
+
+ Inc(FFilesScanned);
+ Synchronize(@UpDateProgress);
+end;
+
procedure TFindThread.WalkAdr(const sNewDir:String);
var
sr: TSearchRecEx;
@@ -343,20 +369,17 @@
Path := sNewDir + PathDelim + '*';
if FindFirstEx(Path, faAnyFile, sr) = 0 then
- repeat
- if not FPS_ISDIR(sr.Attr) then
- begin
- if CheckFile(sNewDir, sr) then
- begin
- FFoundFile := sNewDir + PathDelim + sr.Name;
- Synchronize(@AddFile);
- Inc(FFilesFound);
- end;
-
- Inc(FFilesScanned);
- Synchronize(@UpDateProgress);
- end;
- until (FindNextEx(sr)<>0) or Terminated;
+ begin
+ repeat
+ if not FPS_ISDIR(sr.Attr) then
+ DoFile(sNewDir, sr)
+ until (FindNextEx(sr)<>0) or Terminated;
+ end else
+ begin
+ Path := sNewDir;
+ if FindFirstEx(Path, faAnyFile, sr) = 0 then
+ DoFile(ExtractFileDir(Path), sr);
+ end;
FindCloseEx(sr);
Synchronize(@UpDateProgress);
@@ -365,7 +388,7 @@
begin
if FindFirstEx(Path, faDirectory, sr) = 0 then
repeat
- if CheckDirectory(sNewDir, sr.Name) then
+ if FPS_ISDIR(sr.Attr) and CheckDirectory(sNewDir, sr.Name) then
begin
SubPath := sNewDir + PathDelim + sr.Name;
IsLink := FPS_ISLNK(sr.Attr);
Index: src/umaincommands.pas
===================================================================
--- src/umaincommands.pas (revision 4952)
+++ src/umaincommands.pas (working copy)
@@ -2007,7 +2007,7 @@
procedure TMainCommands.cm_Search(const Params: array of string);
begin
- ShowFindDlg(frmMain.ActiveFrame.CurrentPath);
+ ShowFindDlg(frmMain.ActiveFrame);
end;
findsel4956.patch (11,293 bytes)
Index: language/doublecmd.po
===================================================================
--- language/doublecmd.po (revision 4956)
+++ language/doublecmd.po (working copy)
@@ -1871,6 +1871,10 @@
msgid "Re&place by"
msgstr ""
+#: tfrmfinddlg.cbselectedfiles.caption
+msgid "Selected directories and &files"
+msgstr ""
+
#: tfrmfinddlg.cbtimefrom.caption
msgid "&Time from:"
msgstr ""
Index: language/doublecmd.ru.po
===================================================================
--- language/doublecmd.ru.po (revision 4956)
+++ language/doublecmd.ru.po (working copy)
@@ -1889,6 +1889,10 @@
msgid "Re&place by"
msgstr "З&аменить текст"
+#: tfrmfinddlg.cbselectedfiles.caption
+msgid "Selected directories and &files"
+msgstr "&Выбранные файлы и каталоги"
+
#: tfrmfinddlg.cbtimefrom.caption
msgid "&Time from:"
msgstr "&Время от:"
Index: src/fFindDlg.lfm
===================================================================
--- src/fFindDlg.lfm (revision 4956)
+++ src/fFindDlg.lfm (working copy)
@@ -170,6 +170,20 @@
TabOrder = 0
end
end
+ object cbSelectedFiles: TCheckBox
+ AnchorSideTop.Side = asrBottom
+ AnchorSideRight.Control = cbFollowSymLinks
+ AnchorSideBottom.Control = cbFollowSymLinks
+ AnchorSideBottom.Side = asrBottom
+ Left = 428
+ Height = 19
+ Top = 0
+ Width = 169
+ Anchors = [akRight, akBottom]
+ Caption = 'Selected directories and &files'
+ OnChange = cbSelectedFilesChange
+ TabOrder = 4
+ end
end
object gbFiles: TGroupBox
AnchorSideLeft.Control = tsStandard
Index: src/fFindDlg.lrt
===================================================================
--- src/fFindDlg.lrt (revision 4956)
+++ src/fFindDlg.lrt (working copy)
@@ -6,6 +6,7 @@
TFRMFINDDLG.LBLEXCLUDEDIRECTORIES.CAPTION=E&xclude subdirectories
TFRMFINDDLG.CMBEXCLUDEDIRECTORIES.HINT=Enter directories names that should be excluded from search separated with ";"
TFRMFINDDLG.LBLSEARCHDEPTH.CAPTION=Search su&bdirectories:
+TFRMFINDDLG.CBSELECTEDFILES.CAPTION=Selected directories and &files
TFRMFINDDLG.GBFILES.CAPTION=Files
TFRMFINDDLG.LBLFINDFILEMASK.CAPTION=&File mask
TFRMFINDDLG.CMBFINDFILEMASK.HINT=Enter files names separated with ";"
Index: src/fFindDlg.pas
===================================================================
--- src/fFindDlg.pas (revision 4956)
+++ src/fFindDlg.pas (working copy)
@@ -33,7 +33,7 @@
Graphics, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, ComCtrls,
ExtCtrls, Menus, EditBtn, Spin, Buttons, ZVDateTimePicker, KASComboBox,
fAttributesEdit, uDsxModule, DsxPlugin, uFindThread, uFindFiles,
- uSearchTemplate;
+ uSearchTemplate, uFileView;
type
@@ -71,6 +71,7 @@
cbPartialNameSearch: TCheckBox;
cbFollowSymLinks: TCheckBox;
cbUsePlugin: TCheckBox;
+ cbSelectedFiles: TCheckBox;
cmbExcludeDirectories: TComboBoxWithDelItems;
cmbNotOlderThanUnit: TComboBox;
cmbFileSizeUnit: TComboBox;
@@ -142,6 +143,7 @@
procedure cbDateToChange(Sender: TObject);
procedure cbPartialNameSearchChange(Sender: TObject);
procedure cbRegExpChange(Sender: TObject);
+ procedure cbSelectedFilesChange(Sender: TObject);
procedure cmbEncodingSelect(Sender: TObject);
procedure cbFindTextChange(Sender: TObject);
procedure cbUsePluginChange(Sender: TObject);
@@ -185,6 +187,9 @@
procedure ZVTimeFromChange(Sender: TObject);
procedure ZVTimeToChange(Sender: TObject);
private
+ FFileView: TFileView;
+ FSelectedFiles: TStringList;
+
FFindThread:TFindThread;
DsxPlugins: TDSXModuleList;
FSearchingActive: Boolean;
@@ -218,7 +223,7 @@
var
FoundedStringCopy: TStringlist = nil;
-procedure ShowFindDlg(const sActPath: UTF8String);
+procedure ShowFindDlg(FileView: TFileView);
function ShowDefineTemplateDlg(var TemplateName: UTF8String): Boolean;
function ShowUseTemplateDlg(var Template: TSearchTemplate): Boolean;
@@ -230,7 +235,7 @@
LCLProc, LCLType, LConvEncoding, StrUtils, HelpIntfs, fViewer, fMain,
uLng, uGlobs, uShowForm, uDCUtils,
uSearchResultFileSource, uFile, uFileSystemFileSource,
- uFileViewNotebook, uFileView, uColumnsFileView, uKeyboard,
+ uFileViewNotebook, uColumnsFileView, uKeyboard,
DCOSUtils;
const
@@ -271,14 +276,15 @@
Application.ProcessMessages;
end;
-procedure ShowFindDlg(const sActPath: UTF8String);
+procedure ShowFindDlg(FileView: TFileView);
begin
with TfrmFindDlg.Instance do
begin
// Prepare window for search files
ClearFilter;
+ FFileView := FileView;
Caption := rsFindSearchFiles;
- edtFindPathStart.Text := sActPath;
+ edtFindPathStart.Text := FileView.CurrentPath;
ShowOnTop;
end;
end;
@@ -417,6 +423,8 @@
edtFindPathStart.ShowHidden := gShowSystemFiles;
cbPartialNameSearch.Checked:= gPartialNameSearch;
+ FSelectedFiles := TStringList.Create;
+
InitPropStorage(Self);
end;
@@ -449,6 +457,7 @@
destructor TfrmFindDlg.Destroy;
begin
inherited Destroy;
+ FSelectedFiles.Free;
FLastSearchTemplate.Free;
end;
@@ -602,6 +611,11 @@
if cbRegExp.Checked then cbPartialNameSearch.Checked:=False;
end;
+procedure TfrmFindDlg.cbSelectedFilesChange(Sender: TObject);
+begin
+ edtFindPathStart.Enabled := not cbSelectedFiles.Checked;
+end;
+
procedure TfrmFindDlg.btnSelDirClick(Sender: TObject);
var
s:String;
@@ -809,6 +823,7 @@
sPath : UTF8String;
sr: TDsxSearchRecord;
SearchTemplate, TmpTemplate: TSearchTemplateRec;
+ I: Integer;
begin
sTemp:= edtFindPathStart.Text;
repeat
@@ -866,6 +881,16 @@
TmpTemplate.StartPath := ''; // Don't remember starting path.
FLastSearchTemplate.SearchRecord := TmpTemplate;
+ FSelectedFiles.Clear;
+ if cbSelectedFiles.Checked then begin
+ for I := 0 to FFileView.DisplayFiles.Count - 1 do begin
+ if FFileView.DisplayFiles[i].Selected then begin
+ sTemp := FFileView.DisplayFiles[I].FSFile.FullPath;
+ FSelectedFiles.Add(sTemp);
+ end;
+ end;
+ end;
+
try
if (cbUsePlugin.Checked) and (cmbPlugin.ItemIndex<>-1) then
begin
@@ -880,7 +905,7 @@
end
else
begin
- FFindThread := TFindThread.Create(SearchTemplate);
+ FFindThread := TFindThread.Create(SearchTemplate, FSelectedFiles);
with FFindThread do
begin
Items := FoundedStringCopy;
@@ -1109,6 +1134,9 @@
if pgcSearch.ActivePage = tsStandard then
if cmbFindFileMask.CanFocus then
cmbFindFileMask.SetFocus;
+
+ cbSelectedFiles.Checked := FFileView.HasSelectedFiles;
+ cbSelectedFiles.Enabled := FFileView.HasSelectedFiles;
end;
procedure TfrmFindDlg.gbDirectoriesResize(Sender: TObject);
Index: src/ufindthread.pas
===================================================================
--- src/ufindthread.pas (revision 4956)
+++ src/ufindthread.pas (working copy)
@@ -47,6 +47,7 @@
FFoundFile:String;
FCurrentDepth: Integer;
FSearchTemplate: TSearchTemplateRec;
+ FSelectedFiles: TStringList;
FFileChecks: TFindFileChecks;
FLinkTargets: TStringList; // A list of encountered directories (for detecting cycles)
@@ -57,9 +58,10 @@
protected
procedure Execute; override;
public
- constructor Create(const AFindOptions: TSearchTemplateRec);
+ constructor Create(const AFindOptions: TSearchTemplateRec; SelectedFiles: TStringList);
destructor Destroy; override;
procedure AddFile;
+ procedure DoFile(const sNewDir:String; const sr : TSearchRecEx);
procedure WalkAdr(const sNewDir:String);
procedure UpDateProgress;
function IsAborting: Boolean;
@@ -79,12 +81,13 @@
{ TFindThread }
-constructor TFindThread.Create(const AFindOptions: TSearchTemplateRec);
+constructor TFindThread.Create(const AFindOptions: TSearchTemplateRec; SelectedFiles: TStringList);
begin
inherited Create(True);
FLinkTargets := TStringList.Create;
FSearchTemplate := AFindOptions;
+ FSelectedFiles := SelectedFiles;
with FSearchTemplate do
begin
@@ -114,6 +117,7 @@
procedure TFindThread.Execute;
var
sTemp, sPath: UTF8String;
+ I: Integer;
begin
FreeOnTerminate := True;
@@ -121,15 +125,24 @@
Assert(Assigned(FItems),'assert:FItems is empty');
Synchronize(@UpDateProgress);
FCurrentDepth:= -1;
- sTemp:= FSearchTemplate.StartPath;
- while sTemp <> EmptyStr do
+ if FSelectedFiles.Count = 0 then
+ begin
+ sTemp:= FSearchTemplate.StartPath;
+ while sTemp <> EmptyStr do
+ begin
+ sPath:= Copy2SymbDel(sTemp, ';');
+ sPath:= ExcludeBackPathDelimiter(sPath);
+ WalkAdr(sPath);
+ end;
+ FCurrentDir:= rsOperFinished;
+ Synchronize(@UpDateProgress);
+ end else
+ begin
+ for I := 0 to FSelectedFiles.Count - 1 do
begin
- sPath:= Copy2SymbDel(sTemp, ';');
- sPath:= ExcludeBackPathDelimiter(sPath);
- WalkAdr(sPath);
+ WalkAdr(FSelectedFiles[I]);
end;
- FCurrentDir:= rsOperFinished;
- Synchronize(@UpDateProgress);
+ end;
except
on E:Exception do
msgError(Self, E.Message);
@@ -327,6 +340,19 @@
end;
end;
+procedure TFindThread.DoFile(const sNewDir:String; const sr : TSearchRecEx);
+begin
+ if CheckFile(sNewDir, sr) then
+ begin
+ FFoundFile := sNewDir + PathDelim + sr.Name;
+ Synchronize(@AddFile);
+ Inc(FFilesFound);
+ end;
+
+ Inc(FFilesScanned);
+ Synchronize(@UpDateProgress);
+end;
+
procedure TFindThread.WalkAdr(const sNewDir:String);
var
sr: TSearchRecEx;
@@ -343,20 +369,17 @@
Path := sNewDir + PathDelim + '*';
if FindFirstEx(Path, faAnyFile, sr) = 0 then
- repeat
- if not FPS_ISDIR(sr.Attr) then
- begin
- if CheckFile(sNewDir, sr) then
- begin
- FFoundFile := sNewDir + PathDelim + sr.Name;
- Synchronize(@AddFile);
- Inc(FFilesFound);
- end;
-
- Inc(FFilesScanned);
- Synchronize(@UpDateProgress);
- end;
- until (FindNextEx(sr)<>0) or Terminated;
+ begin
+ repeat
+ if not FPS_ISDIR(sr.Attr) then
+ DoFile(sNewDir, sr)
+ until (FindNextEx(sr)<>0) or Terminated;
+ end else
+ begin
+ Path := sNewDir;
+ if FindFirstEx(Path, faAnyFile, sr) = 0 then
+ DoFile(ExtractFileDir(Path), sr);
+ end;
FindCloseEx(sr);
Synchronize(@UpDateProgress);
@@ -365,7 +388,7 @@
begin
if FindFirstEx(Path, faDirectory, sr) = 0 then
repeat
- if CheckDirectory(sNewDir, sr.Name) then
+ if FPS_ISDIR(sr.Attr) and CheckDirectory(sNewDir, sr.Name) then
begin
SubPath := sNewDir + PathDelim + sr.Name;
IsLink := FPS_ISLNK(sr.Attr);
Index: src/umaincommands.pas
===================================================================
--- src/umaincommands.pas (revision 4956)
+++ src/umaincommands.pas (working copy)
@@ -2007,7 +2007,7 @@
procedure TMainCommands.cm_Search(const Params: array of string);
begin
- ShowFindDlg(frmMain.ActiveFrame.CurrentPath);
+ ShowFindDlg(frmMain.ActiveFrame);
end;
| ||||
| Fixed in Revision | 4967,4968 | ||||
| Operating system | |||||
| Widgetset | |||||
| Architecture | |||||
|
|
patch updated to 4956r |
|
|
Имеется небольшая логическая проблема, какие выделенные файлы использовать: - файлы выделенные на момент открытия диалога поиска - файлы выделенные на момент старта поиска Мне кажется более правильным первый вариант, но в этом случае надо создавать список выделенных файлов при открытии поиска, а не в момент его старта как сейчас. |
|
|
Применил с некоторыми доработками (как мне показалось немного оптимальнее). |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-09-08 21:52 | pktfag | New Issue | |
| 2012-09-08 21:52 | pktfag | File Added: findsel.patch | |
| 2012-09-09 14:32 | pktfag | Note Added: 0000882 | |
| 2012-09-09 14:33 | pktfag | File Added: findsel4956.patch | |
| 2012-09-15 14:19 | Alexx2000 | Assigned To | => Alexx2000 |
| 2012-09-15 14:19 | Alexx2000 | Status | new => assigned |
| 2012-09-15 15:11 | Alexx2000 | Note Added: 0000917 | |
| 2012-09-16 19:49 | Alexx2000 | Fixed in Revision | => 4967,4968 |
| 2012-09-16 19:49 | Alexx2000 | Note Added: 0000918 | |
| 2012-09-16 19:49 | Alexx2000 | Status | assigned => resolved |
| 2012-09-16 19:49 | Alexx2000 | Fixed in Version | => 0.5.5 |
| 2012-09-16 19:49 | Alexx2000 | Resolution | open => fixed |
| 2014-01-14 09:02 | Alexx2000 | Status | resolved => closed |