copy history excludes appended filename path segment; always check open output folder, unless manually changing registry

This commit is contained in:
shunf4
2024-09-03 00:21:26 +08:00
parent fb962a8070
commit dee3259e58
4 changed files with 19 additions and 7 deletions

View File

@@ -610,6 +610,7 @@ void CApp::OnCopy(bool move, bool copyToSame, unsigned srcPanelIndex)
CRecordVector<UInt32> indices; CRecordVector<UInt32> indices;
UString destPath; UString destPath;
UString destPathBeforeAppendingFilename;
bool openOutputFolder; bool openOutputFolder;
bool deleteSourceFile; bool deleteSourceFile;
bool close7Zip; bool close7Zip;
@@ -663,6 +664,7 @@ void CApp::OnCopy(bool move, bool copyToSame, unsigned srcPanelIndex)
close7Zip = copyDialog.m_bClose7Zip; close7Zip = copyDialog.m_bClose7Zip;
destPath = copyDialog.Value; destPath = copyDialog.Value;
destPathBeforeAppendingFilename = copyDialog.isActuallyAppendingFilename ? copyDialog.ValueBeforeAppendingFilename : destPath;
} }
{ {
@@ -787,7 +789,7 @@ void CApp::OnCopy(bool move, bool copyToSame, unsigned srcPanelIndex)
if (!destIsFsPath) if (!destIsFsPath)
useDestPanel = true; useDestPanel = true;
AddUniqueStringToHeadOfList(copyFolders, destPath); AddUniqueStringToHeadOfList(copyFolders, destPathBeforeAppendingFilename);
while (copyFolders.Size() > 20) while (copyFolders.Size() > 20)
copyFolders.DeleteBack(); copyFolders.DeleteBack();
SaveCopyHistory(copyFolders); SaveCopyHistory(copyFolders);

View File

@@ -63,6 +63,7 @@ bool CCopyDialog::OnInit()
m_sizeMinWindow.cy = (RECT_SIZE_Y(rc))*4/5; m_sizeMinWindow.cy = (RECT_SIZE_Y(rc))*4/5;
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
m_strRealFileName.Empty(); m_strRealFileName.Empty();
ValueBeforeAppendingFilename.Empty();
if (IsDirectory(m_currentFolderPrefix)) if (IsDirectory(m_currentFolderPrefix))
{ {
EnableItem(IDC_COPY_ADD_FILE_NAME, false); EnableItem(IDC_COPY_ADD_FILE_NAME, false);
@@ -264,12 +265,16 @@ void CCopyDialog::OnButtonAddFileName()
} }
if (strLastDir != m_strRealFileName) if (strLastDir != m_strRealFileName)
{ {
ValueBeforeAppendingFilename = currentPath;
currentPath += L'\\'; currentPath += L'\\';
currentPath += m_strRealFileName; currentPath += m_strRealFileName;
_path.SetText(currentPath); _path.SetText(currentPath);
isActuallyAppendingFilename = true;
} else { } else {
_path.SetText(currentPath.Mid(0, n)); _path.SetText(currentPath.Mid(0, n));
isActuallyAppendingFilename = false;
} }
_path.SetFocus(); _path.SetFocus();
} }

View File

@@ -31,7 +31,7 @@ protected:
public: public:
// soleDir=2: undecided // soleDir=2: undecided
CCopyDialog(): soleDir(2), m_bOpenOutputFolder(false), m_bDeleteSourceFile(false), m_bClose7Zip (false) { m_sizeMinWindow.cx = 0; m_sizeMinWindow.cy = 0; } CCopyDialog(): soleDir(2), m_bOpenOutputFolder(false), m_bDeleteSourceFile(false), m_bClose7Zip (false), isActuallyAppendingFilename(false) { m_sizeMinWindow.cx = 0; m_sizeMinWindow.cy = 0; }
UString Title; UString Title;
UString Static; UString Static;
@@ -48,6 +48,10 @@ public:
UString m_currentFolderPrefix; UString m_currentFolderPrefix;
UString m_strRealFileName; UString m_strRealFileName;
UString ValueBeforeAppendingFilename;
bool isActuallyAppendingFilename;
INT_PTR Create(HWND parentWindow = NULL) { return CModalDialog::Create(IDD_COPY, parentWindow); } INT_PTR Create(HWND parentWindow = NULL) { return CModalDialog::Create(IDD_COPY, parentWindow); }
bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam); bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);

View File

@@ -317,19 +317,20 @@ void AddUniqueStringToHeadOfList(UStringVector &list, const UString &s)
void SaveOptOpenOutputFolder(bool bOpen) void SaveOptOpenOutputFolder(bool bOpen)
{ {
CKey key; // CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath); // key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(kOpenOutputFolderValueName, bOpen); // key.SetValue(kOpenOutputFolderValueName, bOpen);
(void)(bOpen);
} }
bool ReadOptOpenOutputFolder() bool ReadOptOpenOutputFolder()
{ {
CKey key; CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS) if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
return false; return true;
bool bOpen; bool bOpen;
if (key.QueryValue(kOpenOutputFolderValueName, bOpen) != ERROR_SUCCESS) if (key.QueryValue(kOpenOutputFolderValueName, bOpen) != ERROR_SUCCESS)
return false; return true;
return bOpen; return bOpen;
} }