From 918e8fdd01587bf7b5c4593ac7830865b20d9acb Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 30 Jul 2005 12:25:49 +0000 Subject: [PATCH] PATCH: [ 1247375 ] Use Shell Edit command primarily to open files --- Src/DirActions.cpp | 14 +++++++++++--- Src/readme.txt | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Src/DirActions.cpp b/Src/DirActions.cpp index afe4f95d7..d162ccb40 100644 --- a/Src/DirActions.cpp +++ b/Src/DirActions.cpp @@ -1002,17 +1002,25 @@ void CDirView::GetItemFileNames(int sel, PathContext * paths) const paths->SetRight(strRight); } -/// Open selected file on specified side +/** + * @brief Open selected file with registered application. + * Uses shell file associations to open file with registered + * application. We first try to use "Edit" action which should + * open file to editor, since we are more interested editing + * files than running them (scripts). + * @param [in] stype Side of file to open. + */ void CDirView::DoOpen(SIDE_TYPE stype) { int sel = GetSingleSelectedItem(); if (sel == -1) return; CString file = GetSelectedFileName(stype); if (file.IsEmpty()) return; - int rtn = (int)ShellExecute(::GetDesktopWindow(), _T("open"), file, 0, 0, SW_SHOWNORMAL); + int rtn = (int)ShellExecute(::GetDesktopWindow(), _T("edit"), file, 0, 0, SW_SHOWNORMAL); + if (rtn==SE_ERR_NOASSOC) + rtn = (int)ShellExecute(::GetDesktopWindow(), _T("open"), file, 0, 0, SW_SHOWNORMAL); if (rtn==SE_ERR_NOASSOC) DoOpenWith(stype); - } /// Open with dialog for file on selected side diff --git a/Src/readme.txt b/Src/readme.txt index 1702e02ba..cb142389f 100644 --- a/Src/readme.txt +++ b/Src/readme.txt @@ -1,3 +1,7 @@ +2005-07-30 Kimmo + PATCH: [ 1247375 ] Use Shell Edit command primarily to open files + Src: DirActions.cpp + 2005-07-29 Kimmo PATCH: [ 1245773 ] Scan full files in quick contents compare Src: DiffWrapper.cpp -- 2.11.0