Skip to content

Commit

Permalink
Use Extract dialog when extracting without selection. (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhngtu authored May 26, 2024
1 parent b45dc7e commit b78c093
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 2 deletions.
37 changes: 36 additions & 1 deletion NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/FileManager/Panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ void CPanel::ExtractArchives()
{
if (_parentFolders.Size() > 0)
{
_panelCallback->OnCopy(false, false);
ExtractFromArchive();
return;
}
CRecordVector<UInt32> indices;
Expand All @@ -1015,6 +1015,41 @@ void CPanel::ExtractArchives()
);
}

void CPanel::ExtractFromArchive()
{
if (_parentFolders.Size() > 1) {
_panelCallback->OnCopy(false, false);
return;
}

CRecordVector<UInt32> indices;
GetOperatedItemIndices(indices);
if (indices.Size() > 0) {
_panelCallback->OnCopy(false, false);
return;
}

UString path = GetFsPath();
if (IsPathSepar(path.Back()))
path.DeleteBack();
if (path != _parentFolders[0].VirtualPath) {
_panelCallback->OnCopy(false, false);
return;
}
UStringVector paths;
paths.Add(path);
UString outFolder = GetSubFolderNameForExtract2(path);

CContextMenuInfo ci;
ci.Load();

::ExtractArchives(paths, outFolder
, true // showDialog
, false // elimDup
, ci.WriteZone
);
}

/*
static void AddValuePair(UINT resourceID, UInt64 value, UString &s)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ class CPanel: public NWindows::NControl::CWindow2

void GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths, bool allowFolders = false);
void ExtractArchives();
void ExtractFromArchive();
void TestArchives();

HRESULT CopyTo(CCopyToOptions &options,
Expand Down
37 changes: 36 additions & 1 deletion NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/Panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ void CPanel::ExtractArchives()
{
if (_parentFolders.Size() > 0)
{
_panelCallback->OnCopy(false, false);
ExtractFromArchive();
return;
}
CRecordVector<UInt32> indices;
Expand All @@ -1015,6 +1015,41 @@ void CPanel::ExtractArchives()
);
}

void CPanel::ExtractFromArchive()
{
if (_parentFolders.Size() > 1) {
_panelCallback->OnCopy(false, false);
return;
}

CRecordVector<UInt32> indices;
GetOperatedItemIndices(indices);
if (indices.Size() > 0) {
_panelCallback->OnCopy(false, false);
return;
}

UString path = GetFsPath();
if (IsPathSepar(path.Back()))
path.DeleteBack();
if (path != _parentFolders[0].VirtualPath) {
_panelCallback->OnCopy(false, false);
return;
}
UStringVector paths;
paths.Add(path);
UString outFolder = GetSubFolderNameForExtract2(path);

CContextMenuInfo ci;
ci.Load();

::ExtractArchives(paths, outFolder
, true // showDialog
, false // elimDup
, ci.WriteZone
);
}

/*
static void AddValuePair(UINT resourceID, UInt64 value, UString &s)
{
Expand Down
1 change: 1 addition & 0 deletions NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/FileManager/Panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ class CPanel: public NWindows::NControl::CWindow2

void GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths, bool allowFolders = false);
void ExtractArchives();
void ExtractFromArchive();
void TestArchives();

HRESULT CopyTo(CCopyToOptions &options,
Expand Down

0 comments on commit b78c093

Please sign in to comment.