mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 10:11:38 -06:00
feat: opens sole folder instead of upper folder after extraction; cancel folder priority over file in comparison; other minor ui fix
This commit is contained in:
@@ -1530,7 +1530,7 @@ STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
|
||||
// do we need another base folder for subfolders ?
|
||||
extractCallbackSpec->DirPathPrefix_for_HashFiles = _agentSpec->_hashBaseFolderPrefix;
|
||||
|
||||
extractCallbackSpec->SoleFolderIndex = soleFolderIndex;
|
||||
extractCallbackSpec->SoleFolderIndex = soleFolderIndex == -1LL ? -1LL : GetRealIndex((int)soleFolderIndex);
|
||||
|
||||
CUIntVector realIndices;
|
||||
GetRealIndices(indices, numItems, IntToBool(includeAltStreams),
|
||||
|
||||
@@ -358,6 +358,11 @@ HRESULT CApp::Create(HWND hwnd, const UString &mainPath, const UString &arcForma
|
||||
|
||||
SetFocusedPanel(LastFocusedPanel);
|
||||
Panels[LastFocusedPanel].SetFocusToList();
|
||||
|
||||
if (pDelayedOpenFolderAfterExtractPathCriticalSection == NULL) {
|
||||
pDelayedOpenFolderAfterExtractPathCriticalSection = new NWindows::NSynchronization::CCriticalSection();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -409,6 +414,10 @@ void CApp::Save()
|
||||
|
||||
void CApp::Release()
|
||||
{
|
||||
if (pDelayedOpenFolderAfterExtractPathCriticalSection != NULL) {
|
||||
delete pDelayedOpenFolderAfterExtractPathCriticalSection;
|
||||
pDelayedOpenFolderAfterExtractPathCriticalSection = NULL;
|
||||
}
|
||||
// It's for unloading COM dll's: don't change it.
|
||||
for (unsigned i = 0; i < kNumPanelsMax; i++)
|
||||
Panels[i].Release();
|
||||
@@ -885,9 +894,49 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
|
||||
if (!g_bProcessError && result == S_OK)
|
||||
{
|
||||
if (openOutputFolder && IsDirectory(destPath))
|
||||
if (openOutputFolder)
|
||||
{
|
||||
StartApplicationDontWait(destPath, destPath, (HWND)_window);
|
||||
bool done = false;
|
||||
if (!done && soleFolderIndex != -1LL) {
|
||||
UString soleFolderName = srcPanel.GetItemRelPath((UInt32)soleFolderIndex);
|
||||
if (soleFolderName.Len() > 0 && (soleFolderName[0] == L'\\' || soleFolderName[0] == L'/' || soleFolderName[0] == '\\' || soleFolderName[0] == '/')) {
|
||||
soleFolderName = soleFolderName.Mid(1, soleFolderName.Len() - 1);
|
||||
}
|
||||
if (soleFolderName.Len() > 0 && (soleFolderName.Back() == L'\\' || soleFolderName.Back() == L'/' || soleFolderName.Back() == '\\' || soleFolderName.Back() == '/')) {
|
||||
soleFolderName.DeleteBack();
|
||||
}
|
||||
UString destPathWithSoleFolder = destPath;
|
||||
destPathWithSoleFolder += L'\\';
|
||||
destPathWithSoleFolder += soleFolderName;
|
||||
if (IsDirectory(destPathWithSoleFolder)) {
|
||||
done = true;
|
||||
if (close7Zip)
|
||||
{
|
||||
StartApplicationDontWait(destPathWithSoleFolder, destPathWithSoleFolder, (HWND)_window);
|
||||
} else {
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(*pDelayedOpenFolderAfterExtractPathCriticalSection);
|
||||
DelayedOpenFolderAfterExtractPath = destPathWithSoleFolder;
|
||||
}
|
||||
_window.SetTimer(1678, 800);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!done) {
|
||||
if (IsDirectory(destPath)) {
|
||||
if (close7Zip)
|
||||
{
|
||||
StartApplicationDontWait(destPath, destPath, (HWND)_window);
|
||||
} else {
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(*pDelayedOpenFolderAfterExtractPathCriticalSection);
|
||||
DelayedOpenFolderAfterExtractPath = destPath;
|
||||
}
|
||||
_window.SetTimer(1678, 800);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (deleteSourceFile)
|
||||
{
|
||||
|
||||
@@ -124,6 +124,9 @@ public:
|
||||
bool ShowButtonsLables;
|
||||
bool LargeButtons;
|
||||
|
||||
UString DelayedOpenFolderAfterExtractPath;
|
||||
NWindows::NSynchronization::CCriticalSection *pDelayedOpenFolderAfterExtractPathCriticalSection;
|
||||
|
||||
CAppState AppState;
|
||||
CPanelCallbackImp m_PanelCallbackImp[kNumPanelsMax];
|
||||
CPanel Panels[kNumPanelsMax];
|
||||
@@ -143,7 +146,9 @@ public:
|
||||
void ReloadLang();
|
||||
|
||||
CApp(): _window(0), NumPanels(2), LastFocusedPanel(0),
|
||||
AutoRefresh_Mode(true)
|
||||
AutoRefresh_Mode(true),
|
||||
DelayedOpenFolderAfterExtractPath(L""),
|
||||
pDelayedOpenFolderAfterExtractPathCriticalSection(NULL)
|
||||
{
|
||||
SetPanels_AutoRefresh_Mode();
|
||||
}
|
||||
|
||||
@@ -1012,6 +1012,24 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
g_App.OnNotify((int)wParam, (LPNMHDR)lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_TIMER:
|
||||
{
|
||||
if (wParam == 1678) {
|
||||
KillTimer(hWnd, 1678);
|
||||
UString p;
|
||||
{
|
||||
NWindows::NSynchronization::CCriticalSectionLock lock(*g_App.pDelayedOpenFolderAfterExtractPathCriticalSection);
|
||||
p = g_App.DelayedOpenFolderAfterExtractPath;
|
||||
g_App.DelayedOpenFolderAfterExtractPath.Wipe_and_Empty();
|
||||
}
|
||||
|
||||
if (!p.IsEmpty()) {
|
||||
StartApplicationDontWait(p, p, hWnd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
case WM_DROPFILES:
|
||||
|
||||
@@ -506,6 +506,13 @@ void CPanel::OnDrag(LPNMLISTVIEW /* nmListView */)
|
||||
if (res == DRAGDROP_S_DROP)
|
||||
{
|
||||
res = dropSourceSpec->Result;
|
||||
/**
|
||||
Unmerged:
|
||||
|
||||
if (dataObjectSpec->m_Transfer.Target.Cmd_Type == NDragMenu::k_OpenArc) {
|
||||
need_Process = false;
|
||||
}
|
||||
*/
|
||||
if (dropSourceSpec->NeedPostCopy)
|
||||
if (!dataObjectSpec->Path.IsEmpty())
|
||||
{
|
||||
@@ -606,11 +613,6 @@ void CDropTarget::PositionCursor(POINTL ptl)
|
||||
{
|
||||
m_Panel = &App->Panels[i];
|
||||
m_IsAppTarget = false;
|
||||
if ((int)i == SrcPanelIndex)
|
||||
{
|
||||
m_PanelDropIsAllowed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
POINT pt3 = pt;
|
||||
if (panel->ScreenToClient(&pt3)) {
|
||||
@@ -623,6 +625,12 @@ void CDropTarget::PositionCursor(POINTL ptl)
|
||||
m_IsPanelAddressComboBoxOrBar = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((int)i == SrcPanelIndex && !m_IsPanelAddressComboBoxOrBar)
|
||||
{
|
||||
m_PanelDropIsAllowed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -194,8 +194,8 @@ int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
|
||||
bool isDir1 = panel->IsItem_Folder((int)lParam1);
|
||||
bool isDir2 = panel->IsItem_Folder((int)lParam2);
|
||||
|
||||
if (isDir1 && !isDir2) return -1;
|
||||
if (isDir2 && !isDir1) return 1;
|
||||
// if (isDir1 && !isDir2) return -1;
|
||||
// if (isDir2 && !isDir1) return 1;
|
||||
|
||||
int result = CompareItems2(lParam1, lParam2, lpData);
|
||||
return panel->_ascending ? result: (-result);
|
||||
|
||||
Reference in New Issue
Block a user