This commit is contained in:
Igor Pavlov
2015-09-22 00:00:00 +00:00
committed by Kornel Lesiński
parent cba375916f
commit f6444c3256
96 changed files with 7301 additions and 2409 deletions

View File

@@ -188,7 +188,7 @@ public:
// File Menu
void OpenItem() { GetFocusedPanel().OpenSelectedItems(true); }
void OpenItemInside() { GetFocusedPanel().OpenFocusedItemAsInternal(); }
void OpenItemInside(const wchar_t *type) { GetFocusedPanel().OpenFocusedItemAsInternal(type); }
void OpenItemOutside() { GetFocusedPanel().OpenSelectedItems(false); }
void EditItem(bool useEditor) { GetFocusedPanel().EditItem(useEditor); }
void Rename() { GetFocusedPanel().RenameFile(); }

View File

@@ -91,15 +91,45 @@ HRESULT CExtractCallbackImp::Open_CheckBreak()
return ProgressDialog->Sync.CheckStop();
}
HRESULT CExtractCallbackImp::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
HRESULT CExtractCallbackImp::Open_SetTotal(const UInt64 *files, const UInt64 *bytes)
{
// if (numFiles != NULL) ProgressDialog->Sync.SetNumFilesTotal(*numFiles);
return S_OK;
HRESULT res = S_OK;
if (!MultiArcMode)
{
if (files)
{
_totalFilesDefined = true;
// res = ProgressDialog->Sync.Set_NumFilesTotal(*files);
}
else
_totalFilesDefined = false;
if (bytes)
{
_totalBytesDefined = true;
ProgressDialog->Sync.Set_NumBytesTotal(*bytes);
}
else
_totalBytesDefined = false;
}
return res;
}
HRESULT CExtractCallbackImp::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
HRESULT CExtractCallbackImp::Open_SetCompleted(const UInt64 *files, const UInt64 *bytes)
{
// if (numFiles != NULL) ProgressDialog->Sync.SetNumFilesCur(*numFiles);
if (!MultiArcMode)
{
if (files)
{
ProgressDialog->Sync.Set_NumFilesCur(*files);
}
if (bytes)
{
}
}
return ProgressDialog->Sync.CheckStop();
}

View File

@@ -284,6 +284,10 @@ public:
UString _lang_Skipping;
UString _lang_Empty;
bool _totalFilesDefined;
bool _totalBytesDefined;
bool MultiArcMode;
CExtractCallbackImp():
#ifndef _NO_CRYPTO
PasswordIsDefined(false),
@@ -291,7 +295,12 @@ public:
#endif
OverwriteMode(NExtract::NOverwriteMode::kAsk),
StreamMode(false),
ProcessAltStreams(true)
ProcessAltStreams(true),
_totalFilesDefined(false),
_totalBytesDefined(false),
MultiArcMode(false)
#ifndef _SFX
, _hashCalc(NULL)
#endif

View File

@@ -2,13 +2,13 @@
#define IDB_LINK_LINK 7701
#define IDT_LINK_PATH_FROM 7702
#define IDT_LINK_PATH_TO 7703
#define IDT_LINK_PATH_FROM 7702
#define IDT_LINK_PATH_TO 7703
#define IDG_LINK_TYPE 7710
#define IDR_LINK_TYPE_HARD 7711
#define IDR_LINK_TYPE_SYM_FILE 7712
#define IDR_LINK_TYPE_SYM_DIR 7713
#define IDR_LINK_TYPE_SYM_FILE 7712
#define IDR_LINK_TYPE_SYM_DIR 7713
#define IDR_LINK_TYPE_JUNCTION 7714

View File

@@ -143,7 +143,9 @@ static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
else
continue;
}
LangString_OnlyFromLangFile(langID, newString);
if (newString.IsEmpty())
continue;
}
@@ -154,7 +156,21 @@ static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
int langPos = FindLangItem(item.wID);
// we don't need lang change for CRC items!!!
LangString_OnlyFromLangFile(langPos >= 0 ? kIDLangPairs[langPos].LangID : item.wID, newString);
UInt32 langID = langPos >= 0 ? kIDLangPairs[langPos].LangID : item.wID;
if (langID == IDM_OPEN_INSIDE_ONE || langID == IDM_OPEN_INSIDE_PARSER)
{
LangString_OnlyFromLangFile(IDM_OPEN_INSIDE, newString);
newString.Replace(L"&", L"");
int tabPos = newString.Find(L"\t");
if (tabPos >= 0)
newString.DeleteFrom(tabPos);
newString += (langID == IDM_OPEN_INSIDE_ONE ? L" *" : L" #");
}
else
LangString_OnlyFromLangFile(langID, newString);
if (newString.IsEmpty())
continue;
@@ -162,6 +178,7 @@ static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
if (tabPos >= 0)
newString += item.StringValue.Ptr(tabPos);
}
{
item.StringValue = newString;
item.fMask = Get_fMask_for_String();
@@ -358,6 +375,7 @@ void CFileMenu::Load(HMENU hMenu, unsigned startPos)
ReadRegDiff(diffPath);
unsigned numRealItems = startPos;
for (unsigned i = 0;; i++)
{
CMenuItem item;
@@ -375,6 +393,13 @@ void CFileMenu::Load(HMENU hMenu, unsigned startPos)
if (item.wID == IDM_DIFF && diffPath.IsEmpty())
continue;
if (item.wID == IDM_OPEN_INSIDE_ONE || item.wID == IDM_OPEN_INSIDE_PARSER)
{
// We use diff as "super mode" marker for additional commands.
if (diffPath.IsEmpty())
continue;
}
bool isOneFsFile = (isFsFolder && numItems == 1 && allAreFiles);
bool disable = (!isOneFsFile && (item.wID == IDM_SPLIT || item.wID == IDM_COMBINE));
@@ -415,6 +440,7 @@ void CFileMenu::Load(HMENU hMenu, unsigned startPos)
numRealItems = startPos;
}
}
destMenu.RemoveAllItemsFrom(numRealItems);
}
@@ -432,7 +458,11 @@ bool ExecuteFileCommand(int id)
{
// File
case IDM_OPEN: g_App.OpenItem(); break;
case IDM_OPEN_INSIDE: g_App.OpenItemInside(); break;
case IDM_OPEN_INSIDE: g_App.OpenItemInside(NULL); break;
case IDM_OPEN_INSIDE_ONE: g_App.OpenItemInside(L"*"); break;
case IDM_OPEN_INSIDE_PARSER: g_App.OpenItemInside(L"#"); break;
case IDM_OPEN_OUTSIDE: g_App.OpenItemOutside(); break;
case IDM_FILE_VIEW: g_App.EditItem(false); break;
case IDM_FILE_EDIT: g_App.EditItem(true); break;

View File

@@ -285,7 +285,7 @@ private:
HRESULT InitColumns();
// void InitColumns2(PROPID sortID);
void InsertColumn(int index);
void InsertColumn(unsigned index);
void SetFocusedSelectedItem(int index, bool select);
HRESULT RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
@@ -351,6 +351,7 @@ public:
*/
return (UInt32)item.lParam;
}
int GetRealItemIndex(int indexInListView) const
{
/*
@@ -690,7 +691,7 @@ public:
void OpenAltStreams();
void OpenFocusedItemAsInternal();
void OpenFocusedItemAsInternal(const wchar_t *type = NULL);
void OpenSelectedItems(bool internal);
void OpenFolderExternal(int index);
@@ -703,13 +704,14 @@ public:
const UString &arcFormat,
bool &encrypted);
HRESULT OpenItemAsArchive(const UString &relPath, const UString &arcFormat, bool &encrypted);
HRESULT OpenItemAsArchive(int index);
HRESULT OpenItemAsArchive(int index, const wchar_t *type = NULL);
void OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
bool editMode, bool useEditor);
bool editMode, bool useEditor, const wchar_t *type = NULL);
HRESULT OnOpenItemChanged(UInt32 index, const wchar_t *fullFilePath, bool usePassword, const UString &password);
LRESULT OnOpenItemChanged(LPARAM lParam);
void OpenItem(int index, bool tryInternal, bool tryExternal);
bool IsVirus_Message(const UString &name);
void OpenItem(int index, bool tryInternal, bool tryExternal, const wchar_t *type = NULL);
void EditItem(bool useEditor);
void EditItem(int index, bool useEditor);

View File

@@ -157,12 +157,6 @@ public:
}
};
static bool IsNameVirus(const UString &name)
{
// return (name.Find(L" ") >= 0);
return (wcsstr(name, L" ") != NULL);
}
struct CTmpProcessInfo: public CTempFileInfo
{
CChildProcesses Processes;
@@ -320,12 +314,12 @@ HRESULT CPanel::OpenItemAsArchive(const UString &relPath, const UString &arcForm
return OpenItemAsArchive(NULL, tfi, fullPath, arcFormat, encrypted);
}
HRESULT CPanel::OpenItemAsArchive(int index)
HRESULT CPanel::OpenItemAsArchive(int index, const wchar_t *type)
{
CDisableTimerProcessing disableTimerProcessing1(*this);
CDisableNotify disableNotify(*this);
bool encrypted;
HRESULT res = OpenItemAsArchive(GetItemRelPath2(index), UString(), encrypted);
HRESULT res = OpenItemAsArchive(GetItemRelPath2(index), type ? type : L"", encrypted);
if (res != S_OK)
{
RefreshTitle(true); // in case of error we must refresh changed title of 7zFM
@@ -600,19 +594,77 @@ void CPanel::OpenFolderExternal(int index)
StartApplicationDontWait(fsPrefix, name, (HWND)*this);
}
void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal)
bool CPanel::IsVirus_Message(const UString &name)
{
UString name2;
const wchar_t cRLO = (wchar_t)0x202E;
bool isVirus = false;
bool isSpaceError = false;
name2 = name;
if (name2.Find(cRLO) >= 0)
{
UString badString = cRLO;
name2.Replace(badString, L"[RLO]");
isVirus = true;
}
{
const wchar_t *kVirusSpaces = L" ";
// const unsigned kNumSpaces = strlen(kVirusSpaces);
for (;;)
{
int pos = name2.Find(kVirusSpaces);
if (pos < 0)
break;
isVirus = true;
isSpaceError = true;
name2.Replace(kVirusSpaces, L" ");
}
}
if (!isVirus)
return false;
UString s = LangString(IDS_VIRUS);
if (!isSpaceError)
{
int pos1 = s.Find(L'(');
if (pos1 >= 0)
{
int pos2 = s.Find(L')', pos1 + 1);
if (pos2 >= 0)
{
s.Delete(pos1, pos2 + 1 - pos1);
if (pos1 > 0 && s[pos1 - 1] == ' ' && s[pos1] == '.')
s.Delete(pos1 - 1);
}
}
}
UString name3 = name;
name3.Replace(L'\n', L'_');
name2.Replace(L'\n', L'_');
s.Add_LF(); s += name2;
s.Add_LF(); s += name3;
MessageBoxMyError(s);
return true;
}
void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal, const wchar_t *type)
{
CDisableTimerProcessing disableTimerProcessing(*this);
UString name = GetItemRelPath2(index);
if (IsNameVirus(name))
{
MessageBoxErrorLang(IDS_VIRUS);
if (IsVirus_Message(name))
return;
}
if (!_parentFolders.IsEmpty())
{
OpenItemInArchive(index, tryInternal, tryExternal, false, false);
OpenItemInArchive(index, tryInternal, tryExternal, false, false, type);
return;
}
@@ -623,7 +675,7 @@ void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal)
if (tryInternal)
if (!tryExternal || !DoItemAlwaysStart(name))
{
HRESULT res = OpenItemAsArchive(index);
HRESULT res = OpenItemAsArchive(index, type);
disableNotify.Restore(); // we must restore to allow text notification update
InvalidateList();
if (res == S_OK || res == E_ABORT)
@@ -634,6 +686,7 @@ void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal)
return;
}
}
if (tryExternal)
{
// SetCurrentDirectory opens HANDLE to folder!!!
@@ -939,16 +992,13 @@ static HRESULT GetTime(IFolderFolder *folder, UInt32 index, PROPID propID, FILET
}
*/
void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode, bool useEditor)
void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode, bool useEditor, const wchar_t *type)
{
const UString name = GetItemName(index);
const UString relPath = GetItemRelPath(index);
if (IsNameVirus(name))
{
MessageBoxErrorLang(IDS_VIRUS);
if (IsVirus_Message(name))
return;
}
if (!_folderOperations)
{
@@ -966,6 +1016,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
MessageBoxLastError();
return;
}
FString tempDir = tempDirectory.GetPath();
FString tempDirNorm = tempDir;
NName::NormalizeDirPathPrefix(tempDirNorm);
@@ -993,7 +1044,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
if (subStream)
{
bool encrypted;
HRESULT res = OpenItemAsArchive(subStream, tempFileInfo, fullVirtPath, UString(), encrypted);
HRESULT res = OpenItemAsArchive(subStream, tempFileInfo, fullVirtPath, type ? type : L"", encrypted);
if (res == S_OK)
{
tempDirectory.DisableDeleting();
@@ -1104,7 +1155,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
CMyComPtr<IInStream> bufInStream = bufInStreamSpec;
bufInStreamSpec->Init(file.Data, streamSize, virtFileSystem);
bool encrypted;
if (OpenItemAsArchive(bufInStream, tempFileInfo, fullVirtPath, UString(), encrypted) == S_OK)
if (OpenItemAsArchive(bufInStream, tempFileInfo, fullVirtPath, type ? type : L"", encrypted) == S_OK)
{
tempDirectory.DisableDeleting();
RefreshListCtrl();
@@ -1130,7 +1181,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
if (tryAsArchive)
{
bool encrypted;
if (OpenItemAsArchive(NULL, tempFileInfo, fullVirtPath, UString(), encrypted) == S_OK)
if (OpenItemAsArchive(NULL, tempFileInfo, fullVirtPath, type ? type : L"", encrypted) == S_OK)
{
tempDirectory.DisableDeleting();
RefreshListCtrl();

View File

@@ -210,14 +210,15 @@ HRESULT CPanel::InitColumns()
*/
_sortID = _listViewInfo.SortID;
_visibleProperties.Sort();
for (i = 0; i < _visibleProperties.Size(); i++)
{
InsertColumn(i);
}
return S_OK;
}
void CPanel::InsertColumn(int index)
void CPanel::InsertColumn(unsigned index)
{
const CItemProperty &prop = _visibleProperties[index];
LV_COLUMNW column;
@@ -225,6 +226,7 @@ void CPanel::InsertColumn(int index)
column.cx = prop.Width;
column.fmt = GetColumnAlign(prop.ID, prop.Type);
column.iOrder = prop.Order;
// iOrder must be <= _listView.ItemCount
column.iSubItem = index;
column.pszText = const_cast<wchar_t *>((const wchar_t *)prop.Name);
_listView.InsertColumn(index, &column);
@@ -775,7 +777,7 @@ void CPanel::EditItem(bool useEditor)
EditItem(realIndex, useEditor);
}
void CPanel::OpenFocusedItemAsInternal()
void CPanel::OpenFocusedItemAsInternal(const wchar_t *type)
{
int focusedItem = _listView.GetFocusedItem();
if (focusedItem < 0)
@@ -784,7 +786,7 @@ void CPanel::OpenFocusedItemAsInternal()
if (IsItem_Folder(realIndex))
OpenFolder(realIndex);
else
OpenItem(realIndex, true, false);
OpenItem(realIndex, true, false, type);
}
void CPanel::OpenSelectedItems(bool tryInternal)
@@ -1059,10 +1061,10 @@ void CPanel::ShowColumnsContextMenu(int x, int y)
if (prop.IsVisible)
{
int prevVisibleSize = _visibleProperties.Size();
prop.Order = prevVisibleSize;
unsigned num = _visibleProperties.Size();
prop.Order = num;
_visibleProperties.Add(prop);
InsertColumn(prevVisibleSize);
InsertColumn(num);
}
else
{

View File

@@ -320,23 +320,33 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
const wchar_t *name = NULL;
unsigned nameLen = 0;
_folderGetItemName->GetItemName(realIndex, &name, &nameLen);
if (name)
{
unsigned dest = 0;
unsigned limit = item.cchTextMax - 1;
for (unsigned i = 0; dest < limit;)
{
wchar_t c = name[i++];
if (c == 0)
break;
text[dest++] = c;
if (c != ' ')
{
if (c != 0x202E) // RLO
continue;
text[dest - 1] = '_';
continue;
}
if (name[i + 1] != ' ')
continue;
unsigned t = 2;
for (; name[i + t] == ' '; t++);
if (t >= 4 && dest + 4 <= limit)
{
text[dest++] = '.';
@@ -346,6 +356,7 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
i += t;
}
}
text[dest] = 0;
return 0;
}

View File

@@ -47,6 +47,9 @@
#define IDM_LINK 558
#define IDM_ALT_STREAMS 559
#define IDM_OPEN_INSIDE_ONE 590
#define IDM_OPEN_INSIDE_PARSER 591
#define IDM_SELECT_ALL 600
#define IDM_DESELECT_ALL 601
#define IDM_INVERT_SELECTION 602

View File

@@ -19,6 +19,8 @@ BEGIN
BEGIN
MENUITEM "&Open\tEnter", IDM_OPEN
MENUITEM "Open &Inside\tCtrl+PgDn", IDM_OPEN_INSIDE
MENUITEM "Open Inside *", IDM_OPEN_INSIDE_ONE
MENUITEM "Open Inside #", IDM_OPEN_INSIDE_PARSER
MENUITEM "Open O&utside\tShift+Enter", IDM_OPEN_OUTSIDE
MENUITEM "&View\tF3", IDM_FILE_VIEW
MENUITEM "&Edit\tF4", IDM_FILE_EDIT