FIX: View and edit files from search result in file panel

This commit is contained in:
Alexander Koblov 2007-12-24 20:57:55 +00:00
commit c6101efd04
2 changed files with 53 additions and 25 deletions

View file

@ -345,7 +345,7 @@ uses
uTypes, fAbout, uGlobs, uLng, fOptions,{ fViewer,}fconfigtoolbar,
uCopyThread, uFileList, uDeleteThread, uVFSUtil, uWCXModule,
fMkDir, fCopyDlg, fCompareFiles,{ fEditor,} fMoveDlg, uMoveThread, uShowMsg,
fFindDlg, uSpaceThread, fHotDir, fSymLink, fHardLink,
fFindDlg, uSpaceThread, fHotDir, fSymLink, fHardLink, uDCUtils,
fMultiRename, uShowForm, uGlobsPaths, fFileOpDlg, fMsg, fPackDlg, fExtractDlg,
fLinker, fSplitter, uFileProcs, lclType, LCLProc, uOSUtils, uOSForms, uPixMapManager;
@ -483,13 +483,21 @@ procedure TfrmMain.actContextMenuExecute(Sender: TObject);
var
fl : TFileList;
begin
fl := TFileList.Create;
with ActiveFrame do
begin
if pnlFile.PanelMode in [pmArchive, pmVFS] then
begin
msgError(rsMsgErrNotSupported);
UnMarkAll;
Exit;
end;
fl := TFileList.Create;
SelectFileIfNoSelected(GetActiveItem);
CopyListSelectedExpandNames(pnlFile.FileList, fl, ActiveDir, False);
end;
ShowContextMenu(Handle, fl, Mouse.CursorPos.x, Mouse.CursorPos.y);
ActiveFrame.UnMarkAll;
end;
procedure TfrmMain.actLeftOpenDrivesExecute(Sender: TObject);
@ -844,6 +852,8 @@ var
i:Integer;
fr:PFileRecItem;
VFSFileList : TFileList;
sFileName,
sFilePath,
sTempDir : String;
begin
with ActiveFrame do
@ -861,18 +871,23 @@ begin
begin
VFSFileList := TFileList.Create;
VFSFileList.CurrentDirectory := ActiveDir;
fr^.sName := ActiveDir + fr^.sName;
sFileName := ActiveDir + fr^.sName;
New(fr);
fr^.sName := sFileName;
VFSFileList.AddItem(fr);
sTempDir := GetTempDir;
{if }pnlFile.VFS.VFSmodule.VFSCopyOut(VFSFileList, sTempDir, 0);{ then}
begin
sl.Add(sTempDir + ExtractDirLevel(ActiveDir, fr^.sName));
ShowViewerByGlobList(sl, True);
Dispose(fr);
Exit;
end;
end;
sl.Add(ActiveDir+fr^.sName);
DebugLn('View.Add:',ActiveDir+fr^.sName);
sFileName := fr^.sName;
sFilePath := ActiveDir;
sl.Add(GetSplitFileName(sFileName, sFilePath));
DebugLn('View.Add: ', sFilePath + sFileName);
end;
end;
if sl.Count>0 then
@ -905,9 +920,17 @@ var
// sl:TStringList;
i:Integer;
fr:PFileRecItem;
sFileName,
sFilePath : String;
begin
with ActiveFrame do
begin
if pnlFile.PanelMode in [pmArchive, pmVFS] then
begin
msgError(rsMsgErrNotSupported);
UnMarkAll;
Exit;
end;
SelectFileIfNoSelected(GetActiveItem);
try
// in this time we only one file process
@ -916,7 +939,9 @@ begin
fr:=pnlFile.GetFileItemPtr(i);
if fr^.bSelected and not (FPS_ISDIR(fr^.iMode)) then
begin
ShowEditorByGlob(ActiveDir+fr^.sName);
sFileName := fr^.sName;
sFilePath := ActiveDir;
ShowEditorByGlob(GetSplitFileName(sFileName, sFilePath));
Break;
end;
end;

View file

@ -137,7 +137,7 @@ object frmOptions: TfrmOptions
object pgBehav: TPage
Caption = 'pgBehav'
ClientWidth = 446
ClientHeight = 321
ClientHeight = 339
object lblTerm: TLabel
AnchorSideTop.Control = edtTerm
AnchorSideTop.Side = asrCenter
@ -287,18 +287,21 @@ object frmOptions: TfrmOptions
AnchorSideTop.Control = gb
AnchorSideTop.Side = asrBottom
Left = 10
Height = 89
Height = 93
Top = 230
Width = 201
Width = 200
AutoSize = True
BorderSpacing.Top = 6
Caption = 'Date and time'
ClientHeight = 71
ClientWidth = 197
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 75
ClientWidth = 196
TabOrder = 4
object lblDateTimeFormat: TLabel
Left = 8
Left = 6
Height = 14
Top = 2
Top = 6
Width = 107
Caption = 'Date and time format:'
ParentColor = False
@ -306,10 +309,10 @@ object frmOptions: TfrmOptions
object lblDateTimeExample: TLabel
AnchorSideTop.Control = cbDateTimeFormat
AnchorSideTop.Side = asrBottom
Left = 8
Height = 15
Top = 49
Width = 97
Left = 6
Height = 16
Top = 53
Width = 98
BorderSpacing.Top = 6
Font.Style = [fsBold]
ParentColor = False
@ -317,9 +320,9 @@ object frmOptions: TfrmOptions
object cbDateTimeFormat: TComboBox
AnchorSideTop.Control = lblDateTimeFormat
AnchorSideTop.Side = asrBottom
Left = 8
Left = 6
Height = 21
Top = 22
Top = 26
Width = 184
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
BorderSpacing.Top = 6
@ -1444,8 +1447,8 @@ object frmOptions: TfrmOptions
Top = 6
Width = 424
Caption = '&Buffer size for files:'
ClientHeight = 82
ClientWidth = 420
ClientHeight = 100
ClientWidth = 424
TabOrder = 0
object lblCopyBufferSize: TLabel
AnchorSideTop.Side = asrBottom
@ -1477,8 +1480,8 @@ object frmOptions: TfrmOptions
Width = 424
BorderSpacing.Top = 6
Caption = 'General options'
ClientHeight = 82
ClientWidth = 420
ClientHeight = 100
ClientWidth = 424
TabOrder = 1
object cbDropReadOnlyFlag: TCheckBox
Left = 14
@ -1498,8 +1501,8 @@ object frmOptions: TfrmOptions
Width = 424
BorderSpacing.Top = 6
Caption = 'File search'
ClientHeight = 82
ClientWidth = 420
ClientHeight = 100
ClientWidth = 424
TabOrder = 2
object rbUseMmapInSearch: TRadioButton
Left = 14