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

View File

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

View File

@@ -31,7 +31,7 @@ protected:
public:
// 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 Static;
@@ -48,6 +48,10 @@ public:
UString m_currentFolderPrefix;
UString m_strRealFileName;
UString ValueBeforeAppendingFilename;
bool isActuallyAppendingFilename;
INT_PTR Create(HWND parentWindow = NULL) { return CModalDialog::Create(IDD_COPY, parentWindow); }
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)
{
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(kOpenOutputFolderValueName, bOpen);
// CKey key;
// key.Create(HKEY_CURRENT_USER, kCUBasePath);
// key.SetValue(kOpenOutputFolderValueName, bOpen);
(void)(bOpen);
}
bool ReadOptOpenOutputFolder()
{
CKey key;
if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
return false;
return true;
bool bOpen;
if (key.QueryValue(kOpenOutputFolderValueName, bOpen) != ERROR_SUCCESS)
return false;
return true;
return bOpen;
}