Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2015-10-18 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:56 +0300
commita663a6deb7a150f935fac7efdbf4d53d27369594 (patch)
treed1be306b33dd96050206da5774fff7bd9083ddfa /CPP/7zip/UI/FileManager
parent6543c280208393fa32cb0094f770d14c1cfb13b2 (diff)
15.0915.09
Diffstat (limited to 'CPP/7zip/UI/FileManager')
-rw-r--r--CPP/7zip/UI/FileManager/PanelItemOpen.cpp52
-rw-r--r--CPP/7zip/UI/FileManager/ProgressDialog2.cpp34
2 files changed, 56 insertions, 30 deletions
diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
index 8bf40f5e..6658923f 100644
--- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
@@ -85,7 +85,7 @@ public:
CRecordVector<bool> NeedWait;
~CChildProcesses() { CloseAll(); }
- void DisableWait(int index) { NeedWait[index] = false; }
+ void DisableWait(unsigned index) { NeedWait[index] = false; }
void CloseAll()
{
@@ -491,7 +491,19 @@ typedef BOOL (WINAPI * ShellExecuteExWP)(LPSHELLEXECUTEINFOW lpExecInfo);
static HRESULT StartApplication(const UString &dir, const UString &path, HWND window, CProcess &process)
{
+ UString path2 = path;
+
+ #ifdef _WIN32
+ {
+ int dot = path2.ReverseFind_Dot();
+ int separ = path2.ReverseFind_PathSepar();
+ if (dot < 0 || dot < separ)
+ path2 += L'.';
+ }
+ #endif
+
UINT32 result;
+
#ifndef _UNICODE
if (g_IsNT)
{
@@ -500,14 +512,14 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
- execInfo.lpFile = path;
+ execInfo.lpFile = path2;
execInfo.lpParameters = NULL;
execInfo.lpDirectory = dir.IsEmpty() ? NULL : (LPCWSTR)dir;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
ShellExecuteExWP shellExecuteExW = (ShellExecuteExWP)
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "ShellExecuteExW");
- if (shellExecuteExW == 0)
+ if (!shellExecuteExW)
return 0;
shellExecuteExW(&execInfo);
result = (UINT32)(UINT_PTR)execInfo.hInstApp;
@@ -525,23 +537,24 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
- const CSysString sysPath = GetSystemString(path);
+ const CSysString sysPath = GetSystemString(path2);
const CSysString sysDir = GetSystemString(dir);
execInfo.lpFile = sysPath;
execInfo.lpParameters = NULL;
execInfo.lpDirectory =
- #ifdef UNDER_CE
- NULL
- #else
- sysDir.IsEmpty() ? NULL : (LPCTSTR)sysDir
- #endif
- ;
+ #ifdef UNDER_CE
+ NULL
+ #else
+ sysDir.IsEmpty() ? NULL : (LPCTSTR)sysDir
+ #endif
+ ;
execInfo.nShow = SW_SHOWNORMAL;
execInfo.hProcess = 0;
::ShellExecuteEx(&execInfo);
result = (UINT32)(UINT_PTR)execInfo.hInstApp;
process.Attach(execInfo.hProcess);
}
+
if (result <= 32)
{
switch (result)
@@ -553,6 +566,7 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
L"7-Zip", MB_OK | MB_ICONSTOP);
}
}
+
return S_OK;
}
@@ -795,7 +809,7 @@ static THREAD_FUNC_DECL MyThreadFunction(void *param)
for (;;)
{
CRecordVector<HANDLE> handles;
- CRecordVector<int> indices;
+ CUIntVector indices;
FOR_VECTOR (i, processes.Handles)
{
@@ -992,6 +1006,17 @@ static HRESULT GetTime(IFolderFolder *folder, UInt32 index, PROPID propID, FILET
}
*/
+
+/*
+tryInternal tryExternal
+ false false : unused
+ false true : external
+ true false : internal
+ true true : smart based on file extension:
+ !alwaysStart(name) : both
+ alwaysStart(name) : external
+*/
+
void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode, bool useEditor, const wchar_t *type)
{
const UString name = GetItemName(index);
@@ -1008,7 +1033,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
bool tryAsArchive = tryInternal && (!tryExternal || !DoItemAlwaysStart(name));
- UString fullVirtPath = _currentFolderPrefix + relPath;
+ const UString fullVirtPath = _currentFolderPrefix + relPath;
CTempDir tempDirectory;
if (!tempDirectory.Create(kTempDirPrefix))
@@ -1058,6 +1083,8 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
// probably we must show some message here
// return;
}
+ if (!tryExternal)
+ return;
}
}
}
@@ -1126,6 +1153,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
options.folder = fs2us(tempDirNorm);
options.showErrorMessages = true;
+
HRESULT result = CopyTo(options, indices, &messages, usePassword, password);
if (_parentFolders.Size() > 0)
diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
index dc828e72..378ad903 100644
--- a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
+++ b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
@@ -8,12 +8,13 @@
#include "../../../Windows/Control/Static.h"
#include "../../../Windows/ErrorMsg.h"
-#include "ProgressDialog2.h"
-#include "DialogSize.h"
+#include "../GUI/ExtractRes.h"
-#include "ProgressDialog2Res.h"
+#include "LangUtils.h"
-#include "../GUI/ExtractRes.h"
+#include "DialogSize.h"
+#include "ProgressDialog2.h"
+#include "ProgressDialog2Res.h"
using namespace NWindows;
@@ -42,8 +43,6 @@ static const UINT kCreateDelay =
static const DWORD kPauseSleepTime = 100;
-#include "LangUtils.h"
-
#ifdef LANG
static const UInt32 kLangIDs[] =
@@ -705,10 +704,9 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
UInt32 curTime = ::GetTickCount();
+ const UInt64 progressTotal = bytesProgressMode ? total : totalFiles;
+ const UInt64 progressCompleted = bytesProgressMode ? completed : completedFiles;
{
- UInt64 progressTotal = bytesProgressMode ? total : totalFiles;
- UInt64 progressCompleted = bytesProgressMode ? completed : completedFiles;
-
if (IS_UNDEFINED_VAL(progressTotal))
{
// SetPos(0);
@@ -757,9 +755,9 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
}
}
- if (completed != 0)
+ if (progressCompleted != 0)
{
- if (IS_UNDEFINED_VAL(total))
+ if (IS_UNDEFINED_VAL(progressTotal))
{
if (IS_DEFINED_VAL(_prevRemainingSec))
{
@@ -770,8 +768,8 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
else
{
UInt64 remainingTime = 0;
- if (completed < total)
- remainingTime = MyMultAndDiv(_elapsedTime, total - completed, completed);
+ if (progressCompleted < progressTotal)
+ remainingTime = MyMultAndDiv(_elapsedTime, progressTotal - progressCompleted, progressCompleted);
UInt64 remainingSec = remainingTime / 1000;
if (remainingSec != _prevRemainingSec)
{
@@ -783,7 +781,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
}
{
UInt64 elapsedTime = (_elapsedTime == 0) ? 1 : _elapsedTime;
- UInt64 v = (completed * 1000) / elapsedTime;
+ UInt64 v = (progressCompleted * 1000) / elapsedTime;
Byte c = 0;
unsigned moveBits = 0;
if (v >= ((UInt64)10000 << 10)) { moveBits = 20; c = 'M'; }
@@ -811,11 +809,11 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
{
UInt64 percent = 0;
{
- if (IS_DEFINED_VAL(total))
+ if (IS_DEFINED_VAL(progressTotal))
{
- percent = completed * 100;
- if (total != 0)
- percent /= total;
+ percent = progressCompleted * 100;
+ if (progressTotal != 0)
+ percent /= progressTotal;
}
}
if (percent != _prevPercentValue)