From c99f3ebdd639c2adb03d8b44001b10af18516504 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Mon, 17 Aug 2009 00:00:00 +0000 Subject: 9.06 beta --- CPP/7zip/UI/Agent/Agent.h | 4 +-- CPP/7zip/UI/Agent/AgentOut.cpp | 4 +-- CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp | 44 ++++++++++++++++++++++++--------- CPP/7zip/UI/Agent/ArchiveFolderOut.cpp | 2 +- CPP/7zip/UI/Agent/IFolderArchive.h | 2 +- 5 files changed, 37 insertions(+), 19 deletions(-) (limited to 'CPP/7zip/UI/Agent') diff --git a/CPP/7zip/UI/Agent/Agent.h b/CPP/7zip/UI/Agent/Agent.h index b95725e4..50b101f4 100755 --- a/CPP/7zip/UI/Agent/Agent.h +++ b/CPP/7zip/UI/Agent/Agent.h @@ -206,8 +206,8 @@ public: #endif const CArc &GetArc() { return _archiveLink.Arcs.Back(); } - IInArchive *GetArchive() { return GetArc().Archive; } - bool CanUpdate() const { return _archiveLink.Arcs.Size() == 1; } + IInArchive *GetArchive() { if ( _archiveLink.Arcs.IsEmpty()) return 0; return GetArc().Archive; } + bool CanUpdate() const { return _archiveLink.Arcs.Size() <= 1; } }; #ifdef NEW_FOLDER_INTERFACE diff --git a/CPP/7zip/UI/Agent/AgentOut.cpp b/CPP/7zip/UI/Agent/AgentOut.cpp index 51a5affa..5d9ae62d 100755 --- a/CPP/7zip/UI/Agent/AgentOut.cpp +++ b/CPP/7zip/UI/Agent/AgentOut.cpp @@ -5,7 +5,6 @@ #include "Common/IntToString.h" #include "Common/StringConvert.h" -#include "Windows/Defs.h" #include "Windows/FileDir.h" #include "Windows/PropVariant.h" #include "Windows/PropVariantConversions.h" @@ -16,7 +15,6 @@ #include "../../Common/FileStreams.h" #include "../Common/EnumDirItems.h" -#include "../Common/HandlerLoader.h" #include "../Common/OpenArchive.h" #include "../Common/UpdateCallback.h" #include "../Common/UpdatePair.h" @@ -208,7 +206,7 @@ STDMETHODIMP CAgent::DoOperation( if (GetArchive()) { RINOK(ReadItems()); - EnumerateArchiveItems(this, _proxyArchive->RootFolder, L"", arcItems); + EnumerateArchiveItems(this, _proxyArchive->RootFolder, L"", arcItems); } CRecordVector updatePairs2; diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp index 98c75f4d..af9f6df0 100755 --- a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp +++ b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp @@ -6,8 +6,16 @@ #include "Common/StringConvert.h" +extern HINSTANCE g_hInstance; + static inline UINT GetCurrentFileCodePage() - { return AreFileApisANSI() ? CP_ACP : CP_OEMCP; } +{ + #ifdef UNDER_CE + return CP_ACP; + #else + return AreFileApisANSI() ? CP_ACP : CP_OEMCP; + #endif +} void CArchiveFolderManager::LoadFormats() { @@ -61,21 +69,25 @@ STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *ext return StringToBstr(_codecs.Formats[formatIndex].GetAllExtensions(), extensions); } */ + +static void AddIconExt(const CCodecIcons &lib, UString &dest) +{ + for (int j = 0; j < lib.IconPairs.Size(); j++) + { + if (!dest.IsEmpty()) + dest += L' '; + dest += lib.IconPairs[j].Ext; + } +} + STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions) { LoadFormats(); *extensions = 0; UString res; for (int i = 0; i < _codecs->Libs.Size(); i++) - { - const CCodecLib &lib = _codecs->Libs[i]; - for (int j = 0; j < lib.IconPairs.Size(); j++) - { - if (!res.IsEmpty()) - res += L' '; - res += lib.IconPairs[j].Ext; - } - } + AddIconExt(_codecs->Libs[i], res); + AddIconExt(_codecs->InternalIcons, res); return StringToBstr(res, extensions); } @@ -87,13 +99,21 @@ STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPa for (int i = 0; i < _codecs->Libs.Size(); i++) { const CCodecLib &lib = _codecs->Libs[i]; - int ii = lib.FindIconIndex(ext); - if (ii >= 0) + int ii; + if (lib.FindIconIndex(ext, ii)) { *iconIndex = ii; return StringToBstr(GetUnicodeString(lib.Path, GetCurrentFileCodePage()), iconPath); } } + int ii; + if (_codecs->InternalIcons.FindIconIndex(ext, ii)) + { + *iconIndex = ii; + UString path; + NWindows::NDLL::MyGetModuleFileName(g_hInstance, path); + return StringToBstr(path, iconPath); + } return S_OK; } diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp index 8f03f44d..cf3e2d5a 100755 --- a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp +++ b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp @@ -31,7 +31,7 @@ HRESULT CAgentFolder::CommonUpdateOperation( IFolderArchiveUpdateCallback *updateCallback100) { NWorkDir::CInfo workDirInfo; - ReadWorkDirInfo(workDirInfo); + workDirInfo.Load(); UString archiveFilePath = _agentSpec->_archiveFilePath; UString workDir = GetWorkDir(workDirInfo, archiveFilePath); CreateComplexDirectory(workDir); diff --git a/CPP/7zip/UI/Agent/IFolderArchive.h b/CPP/7zip/UI/Agent/IFolderArchive.h index 91da1150..7b5b0ba4 100755 --- a/CPP/7zip/UI/Agent/IFolderArchive.h +++ b/CPP/7zip/UI/Agent/IFolderArchive.h @@ -11,7 +11,7 @@ #include "../Common/ExtractMode.h" #include "../Common/IFileExtractCallback.h" -#define FOLDER_ARCHIVE_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 0x01, x) +#define FOLDER_ARCHIVE_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 0x01, x) #define FOLDER_ARCHIVE_INTERFACE(i, x) FOLDER_ARCHIVE_INTERFACE_SUB(i, IUnknown, x) #define INTERFACE_IArchiveFolder(x) \ -- cgit v1.2.3