1370b324cSopenharmony_ci// ExtractDialog.cpp
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#include "StdAfx.h"
4370b324cSopenharmony_ci
5370b324cSopenharmony_ci#include "../../../Common/StringConvert.h"
6370b324cSopenharmony_ci#include "../../../Common/Wildcard.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_ci#include "../../../Windows/FileName.h"
9370b324cSopenharmony_ci#include "../../../Windows/FileDir.h"
10370b324cSopenharmony_ci#include "../../../Windows/ResourceString.h"
11370b324cSopenharmony_ci
12370b324cSopenharmony_ci#ifndef Z7_NO_REGISTRY
13370b324cSopenharmony_ci#include "../FileManager/HelpUtils.h"
14370b324cSopenharmony_ci#endif
15370b324cSopenharmony_ci
16370b324cSopenharmony_ci
17370b324cSopenharmony_ci#include "../FileManager/BrowseDialog.h"
18370b324cSopenharmony_ci#include "../FileManager/LangUtils.h"
19370b324cSopenharmony_ci#include "../FileManager/resourceGui.h"
20370b324cSopenharmony_ci
21370b324cSopenharmony_ci#include "ExtractDialog.h"
22370b324cSopenharmony_ci#include "ExtractDialogRes.h"
23370b324cSopenharmony_ci#include "ExtractRes.h"
24370b324cSopenharmony_ci
25370b324cSopenharmony_ciusing namespace NWindows;
26370b324cSopenharmony_ciusing namespace NFile;
27370b324cSopenharmony_ciusing namespace NName;
28370b324cSopenharmony_ci
29370b324cSopenharmony_ciextern HINSTANCE g_hInstance;
30370b324cSopenharmony_ci
31370b324cSopenharmony_ci#ifndef Z7_SFX
32370b324cSopenharmony_ci
33370b324cSopenharmony_cistatic const UInt32 kPathMode_IDs[] =
34370b324cSopenharmony_ci{
35370b324cSopenharmony_ci  IDS_EXTRACT_PATHS_FULL,
36370b324cSopenharmony_ci  IDS_EXTRACT_PATHS_NO,
37370b324cSopenharmony_ci  IDS_EXTRACT_PATHS_ABS
38370b324cSopenharmony_ci};
39370b324cSopenharmony_ci
40370b324cSopenharmony_cistatic const UInt32 kOverwriteMode_IDs[] =
41370b324cSopenharmony_ci{
42370b324cSopenharmony_ci  IDS_EXTRACT_OVERWRITE_ASK,
43370b324cSopenharmony_ci  IDS_EXTRACT_OVERWRITE_WITHOUT_PROMPT,
44370b324cSopenharmony_ci  IDS_EXTRACT_OVERWRITE_SKIP_EXISTING,
45370b324cSopenharmony_ci  IDS_EXTRACT_OVERWRITE_RENAME,
46370b324cSopenharmony_ci  IDS_EXTRACT_OVERWRITE_RENAME_EXISTING
47370b324cSopenharmony_ci};
48370b324cSopenharmony_ci
49370b324cSopenharmony_cistatic const
50370b324cSopenharmony_ci  // NExtract::NPathMode::EEnum
51370b324cSopenharmony_ci  int
52370b324cSopenharmony_ci  kPathModeButtonsVals[] =
53370b324cSopenharmony_ci{
54370b324cSopenharmony_ci  NExtract::NPathMode::kFullPaths,
55370b324cSopenharmony_ci  NExtract::NPathMode::kNoPaths,
56370b324cSopenharmony_ci  NExtract::NPathMode::kAbsPaths
57370b324cSopenharmony_ci};
58370b324cSopenharmony_ci
59370b324cSopenharmony_cistatic const
60370b324cSopenharmony_ci  int
61370b324cSopenharmony_ci  // NExtract::NOverwriteMode::EEnum
62370b324cSopenharmony_ci  kOverwriteButtonsVals[] =
63370b324cSopenharmony_ci{
64370b324cSopenharmony_ci  NExtract::NOverwriteMode::kAsk,
65370b324cSopenharmony_ci  NExtract::NOverwriteMode::kOverwrite,
66370b324cSopenharmony_ci  NExtract::NOverwriteMode::kSkip,
67370b324cSopenharmony_ci  NExtract::NOverwriteMode::kRename,
68370b324cSopenharmony_ci  NExtract::NOverwriteMode::kRenameExisting
69370b324cSopenharmony_ci};
70370b324cSopenharmony_ci
71370b324cSopenharmony_ci#endif
72370b324cSopenharmony_ci
73370b324cSopenharmony_ci#ifdef Z7_LANG
74370b324cSopenharmony_ci
75370b324cSopenharmony_cistatic const UInt32 kLangIDs[] =
76370b324cSopenharmony_ci{
77370b324cSopenharmony_ci  IDT_EXTRACT_EXTRACT_TO,
78370b324cSopenharmony_ci  IDT_EXTRACT_PATH_MODE,
79370b324cSopenharmony_ci  IDT_EXTRACT_OVERWRITE_MODE,
80370b324cSopenharmony_ci  // IDX_EXTRACT_ALT_STREAMS,
81370b324cSopenharmony_ci  IDX_EXTRACT_NT_SECUR,
82370b324cSopenharmony_ci  IDX_EXTRACT_ELIM_DUP,
83370b324cSopenharmony_ci  IDG_PASSWORD,
84370b324cSopenharmony_ci  IDX_PASSWORD_SHOW
85370b324cSopenharmony_ci};
86370b324cSopenharmony_ci#endif
87370b324cSopenharmony_ci
88370b324cSopenharmony_ci// static const int kWildcardsButtonIndex = 2;
89370b324cSopenharmony_ci
90370b324cSopenharmony_ci#ifndef Z7_NO_REGISTRY
91370b324cSopenharmony_cistatic const unsigned kHistorySize = 16;
92370b324cSopenharmony_ci#endif
93370b324cSopenharmony_ci
94370b324cSopenharmony_ci#ifndef Z7_SFX
95370b324cSopenharmony_ci
96370b324cSopenharmony_ci// it's used in CompressDialog also
97370b324cSopenharmony_civoid AddComboItems(NControl::CComboBox &combo, const UInt32 *langIDs, unsigned numItems, const int *values, int curVal);
98370b324cSopenharmony_civoid AddComboItems(NControl::CComboBox &combo, const UInt32 *langIDs, unsigned numItems, const int *values, int curVal)
99370b324cSopenharmony_ci{
100370b324cSopenharmony_ci  unsigned curSel = 0;
101370b324cSopenharmony_ci  for (unsigned i = 0; i < numItems; i++)
102370b324cSopenharmony_ci  {
103370b324cSopenharmony_ci    UString s = LangString(langIDs[i]);
104370b324cSopenharmony_ci    s.RemoveChar(L'&');
105370b324cSopenharmony_ci    const int index = (int)combo.AddString(s);
106370b324cSopenharmony_ci    combo.SetItemData(index, (LPARAM)i);
107370b324cSopenharmony_ci    if (values[i] == curVal)
108370b324cSopenharmony_ci      curSel = i;
109370b324cSopenharmony_ci  }
110370b324cSopenharmony_ci  combo.SetCurSel(curSel);
111370b324cSopenharmony_ci}
112370b324cSopenharmony_ci
113370b324cSopenharmony_ci// it's used in CompressDialog also
114370b324cSopenharmony_cibool GetBoolsVal(const CBoolPair &b1, const CBoolPair &b2);
115370b324cSopenharmony_cibool GetBoolsVal(const CBoolPair &b1, const CBoolPair &b2)
116370b324cSopenharmony_ci{
117370b324cSopenharmony_ci  if (b1.Def) return b1.Val;
118370b324cSopenharmony_ci  if (b2.Def) return b2.Val;
119370b324cSopenharmony_ci  return b1.Val;
120370b324cSopenharmony_ci}
121370b324cSopenharmony_ci
122370b324cSopenharmony_civoid CExtractDialog::CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2)
123370b324cSopenharmony_ci{
124370b324cSopenharmony_ci  CheckButton(id, GetBoolsVal(b1, b2));
125370b324cSopenharmony_ci}
126370b324cSopenharmony_ci
127370b324cSopenharmony_civoid CExtractDialog::GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2)
128370b324cSopenharmony_ci{
129370b324cSopenharmony_ci  const bool val = IsButtonCheckedBool(id);
130370b324cSopenharmony_ci  const bool oldVal = GetBoolsVal(b1, b2);
131370b324cSopenharmony_ci  if (val != oldVal)
132370b324cSopenharmony_ci    b1.Def = b2.Def = true;
133370b324cSopenharmony_ci  b1.Val = b2.Val = val;
134370b324cSopenharmony_ci}
135370b324cSopenharmony_ci
136370b324cSopenharmony_ci#endif
137370b324cSopenharmony_ci
138370b324cSopenharmony_cibool CExtractDialog::OnInit()
139370b324cSopenharmony_ci{
140370b324cSopenharmony_ci  #ifdef Z7_LANG
141370b324cSopenharmony_ci  {
142370b324cSopenharmony_ci    UString s;
143370b324cSopenharmony_ci    LangString_OnlyFromLangFile(IDD_EXTRACT, s);
144370b324cSopenharmony_ci    if (s.IsEmpty())
145370b324cSopenharmony_ci      GetText(s);
146370b324cSopenharmony_ci    if (!ArcPath.IsEmpty())
147370b324cSopenharmony_ci    {
148370b324cSopenharmony_ci      s += " : ";
149370b324cSopenharmony_ci      s += ArcPath;
150370b324cSopenharmony_ci    }
151370b324cSopenharmony_ci    SetText(s);
152370b324cSopenharmony_ci    // LangSetWindowText(*this, IDD_EXTRACT);
153370b324cSopenharmony_ci    LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
154370b324cSopenharmony_ci  }
155370b324cSopenharmony_ci  #endif
156370b324cSopenharmony_ci
157370b324cSopenharmony_ci  #ifndef Z7_SFX
158370b324cSopenharmony_ci  _passwordControl.Attach(GetItem(IDE_EXTRACT_PASSWORD));
159370b324cSopenharmony_ci  _passwordControl.SetText(Password);
160370b324cSopenharmony_ci  _passwordControl.SetPasswordChar(TEXT('*'));
161370b324cSopenharmony_ci  _pathName.Attach(GetItem(IDE_EXTRACT_NAME));
162370b324cSopenharmony_ci  #endif
163370b324cSopenharmony_ci
164370b324cSopenharmony_ci  #ifdef Z7_NO_REGISTRY
165370b324cSopenharmony_ci
166370b324cSopenharmony_ci  PathMode = NExtract::NPathMode::kFullPaths;
167370b324cSopenharmony_ci  OverwriteMode = NExtract::NOverwriteMode::kAsk;
168370b324cSopenharmony_ci
169370b324cSopenharmony_ci  #else
170370b324cSopenharmony_ci
171370b324cSopenharmony_ci  _info.Load();
172370b324cSopenharmony_ci
173370b324cSopenharmony_ci  if (_info.PathMode == NExtract::NPathMode::kCurPaths)
174370b324cSopenharmony_ci    _info.PathMode = NExtract::NPathMode::kFullPaths;
175370b324cSopenharmony_ci
176370b324cSopenharmony_ci  if (!PathMode_Force && _info.PathMode_Force)
177370b324cSopenharmony_ci    PathMode = _info.PathMode;
178370b324cSopenharmony_ci  if (!OverwriteMode_Force && _info.OverwriteMode_Force)
179370b324cSopenharmony_ci    OverwriteMode = _info.OverwriteMode;
180370b324cSopenharmony_ci
181370b324cSopenharmony_ci  // CheckButton_TwoBools(IDX_EXTRACT_ALT_STREAMS, AltStreams, _info.AltStreams);
182370b324cSopenharmony_ci  CheckButton_TwoBools(IDX_EXTRACT_NT_SECUR,    NtSecurity, _info.NtSecurity);
183370b324cSopenharmony_ci  CheckButton_TwoBools(IDX_EXTRACT_ELIM_DUP,    ElimDup,    _info.ElimDup);
184370b324cSopenharmony_ci
185370b324cSopenharmony_ci  CheckButton(IDX_PASSWORD_SHOW, _info.ShowPassword.Val);
186370b324cSopenharmony_ci  UpdatePasswordControl();
187370b324cSopenharmony_ci
188370b324cSopenharmony_ci  #endif
189370b324cSopenharmony_ci
190370b324cSopenharmony_ci  _path.Attach(GetItem(IDC_EXTRACT_PATH));
191370b324cSopenharmony_ci
192370b324cSopenharmony_ci  UString pathPrefix = DirPath;
193370b324cSopenharmony_ci
194370b324cSopenharmony_ci  #ifndef Z7_SFX
195370b324cSopenharmony_ci
196370b324cSopenharmony_ci  if (_info.SplitDest.Val)
197370b324cSopenharmony_ci  {
198370b324cSopenharmony_ci    CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
199370b324cSopenharmony_ci    UString pathName;
200370b324cSopenharmony_ci    SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
201370b324cSopenharmony_ci    if (pathPrefix.IsEmpty())
202370b324cSopenharmony_ci      pathPrefix = pathName;
203370b324cSopenharmony_ci    else
204370b324cSopenharmony_ci      _pathName.SetText(pathName);
205370b324cSopenharmony_ci  }
206370b324cSopenharmony_ci  else
207370b324cSopenharmony_ci    ShowItem_Bool(IDE_EXTRACT_NAME, false);
208370b324cSopenharmony_ci
209370b324cSopenharmony_ci  #endif
210370b324cSopenharmony_ci
211370b324cSopenharmony_ci  _path.SetText(pathPrefix);
212370b324cSopenharmony_ci
213370b324cSopenharmony_ci  #ifndef Z7_NO_REGISTRY
214370b324cSopenharmony_ci  for (unsigned i = 0; i < _info.Paths.Size() && i < kHistorySize; i++)
215370b324cSopenharmony_ci    _path.AddString(_info.Paths[i]);
216370b324cSopenharmony_ci  #endif
217370b324cSopenharmony_ci
218370b324cSopenharmony_ci  /*
219370b324cSopenharmony_ci  if (_info.Paths.Size() > 0)
220370b324cSopenharmony_ci    _path.SetCurSel(0);
221370b324cSopenharmony_ci  else
222370b324cSopenharmony_ci    _path.SetCurSel(-1);
223370b324cSopenharmony_ci  */
224370b324cSopenharmony_ci
225370b324cSopenharmony_ci  #ifndef Z7_SFX
226370b324cSopenharmony_ci
227370b324cSopenharmony_ci  _pathMode.Attach(GetItem(IDC_EXTRACT_PATH_MODE));
228370b324cSopenharmony_ci  _overwriteMode.Attach(GetItem(IDC_EXTRACT_OVERWRITE_MODE));
229370b324cSopenharmony_ci
230370b324cSopenharmony_ci  AddComboItems(_pathMode, kPathMode_IDs, Z7_ARRAY_SIZE(kPathMode_IDs), kPathModeButtonsVals, PathMode);
231370b324cSopenharmony_ci  AddComboItems(_overwriteMode, kOverwriteMode_IDs, Z7_ARRAY_SIZE(kOverwriteMode_IDs), kOverwriteButtonsVals, OverwriteMode);
232370b324cSopenharmony_ci
233370b324cSopenharmony_ci  #endif
234370b324cSopenharmony_ci
235370b324cSopenharmony_ci  HICON icon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON));
236370b324cSopenharmony_ci  SetIcon(ICON_BIG, icon);
237370b324cSopenharmony_ci
238370b324cSopenharmony_ci  // CWindow filesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
239370b324cSopenharmony_ci  // filesWindow.Enable(_enableFilesButton);
240370b324cSopenharmony_ci
241370b324cSopenharmony_ci  NormalizePosition();
242370b324cSopenharmony_ci
243370b324cSopenharmony_ci  return CModalDialog::OnInit();
244370b324cSopenharmony_ci}
245370b324cSopenharmony_ci
246370b324cSopenharmony_ci#ifndef Z7_SFX
247370b324cSopenharmony_civoid CExtractDialog::UpdatePasswordControl()
248370b324cSopenharmony_ci{
249370b324cSopenharmony_ci  _passwordControl.SetPasswordChar(IsShowPasswordChecked() ? 0 : TEXT('*'));
250370b324cSopenharmony_ci  UString password;
251370b324cSopenharmony_ci  _passwordControl.GetText(password);
252370b324cSopenharmony_ci  _passwordControl.SetText(password);
253370b324cSopenharmony_ci}
254370b324cSopenharmony_ci#endif
255370b324cSopenharmony_ci
256370b324cSopenharmony_cibool CExtractDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
257370b324cSopenharmony_ci{
258370b324cSopenharmony_ci  switch (buttonID)
259370b324cSopenharmony_ci  {
260370b324cSopenharmony_ci    case IDB_EXTRACT_SET_PATH:
261370b324cSopenharmony_ci      OnButtonSetPath();
262370b324cSopenharmony_ci      return true;
263370b324cSopenharmony_ci    #ifndef Z7_SFX
264370b324cSopenharmony_ci    case IDX_EXTRACT_NAME_ENABLE:
265370b324cSopenharmony_ci      ShowItem_Bool(IDE_EXTRACT_NAME, IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE));
266370b324cSopenharmony_ci      return true;
267370b324cSopenharmony_ci    case IDX_PASSWORD_SHOW:
268370b324cSopenharmony_ci    {
269370b324cSopenharmony_ci      UpdatePasswordControl();
270370b324cSopenharmony_ci      return true;
271370b324cSopenharmony_ci    }
272370b324cSopenharmony_ci    #endif
273370b324cSopenharmony_ci  }
274370b324cSopenharmony_ci  return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
275370b324cSopenharmony_ci}
276370b324cSopenharmony_ci
277370b324cSopenharmony_civoid CExtractDialog::OnButtonSetPath()
278370b324cSopenharmony_ci{
279370b324cSopenharmony_ci  UString currentPath;
280370b324cSopenharmony_ci  _path.GetText(currentPath);
281370b324cSopenharmony_ci  UString title = LangString(IDS_EXTRACT_SET_FOLDER);
282370b324cSopenharmony_ci  UString resultPath;
283370b324cSopenharmony_ci  if (!MyBrowseForFolder(*this, title, currentPath, resultPath))
284370b324cSopenharmony_ci    return;
285370b324cSopenharmony_ci  #ifndef Z7_NO_REGISTRY
286370b324cSopenharmony_ci  _path.SetCurSel(-1);
287370b324cSopenharmony_ci  #endif
288370b324cSopenharmony_ci  _path.SetText(resultPath);
289370b324cSopenharmony_ci}
290370b324cSopenharmony_ci
291370b324cSopenharmony_civoid AddUniqueString(UStringVector &list, const UString &s);
292370b324cSopenharmony_civoid AddUniqueString(UStringVector &list, const UString &s)
293370b324cSopenharmony_ci{
294370b324cSopenharmony_ci  FOR_VECTOR (i, list)
295370b324cSopenharmony_ci    if (s.IsEqualTo_NoCase(list[i]))
296370b324cSopenharmony_ci      return;
297370b324cSopenharmony_ci  list.Add(s);
298370b324cSopenharmony_ci}
299370b324cSopenharmony_ci
300370b324cSopenharmony_civoid CExtractDialog::OnOK()
301370b324cSopenharmony_ci{
302370b324cSopenharmony_ci  #ifndef Z7_SFX
303370b324cSopenharmony_ci  int pathMode2 = kPathModeButtonsVals[_pathMode.GetCurSel()];
304370b324cSopenharmony_ci  if (PathMode != NExtract::NPathMode::kCurPaths ||
305370b324cSopenharmony_ci      pathMode2 != NExtract::NPathMode::kFullPaths)
306370b324cSopenharmony_ci    PathMode = (NExtract::NPathMode::EEnum)pathMode2;
307370b324cSopenharmony_ci
308370b324cSopenharmony_ci  OverwriteMode = (NExtract::NOverwriteMode::EEnum)kOverwriteButtonsVals[_overwriteMode.GetCurSel()];
309370b324cSopenharmony_ci
310370b324cSopenharmony_ci  // _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
311370b324cSopenharmony_ci
312370b324cSopenharmony_ci  _passwordControl.GetText(Password);
313370b324cSopenharmony_ci
314370b324cSopenharmony_ci  #endif
315370b324cSopenharmony_ci
316370b324cSopenharmony_ci  #ifndef Z7_NO_REGISTRY
317370b324cSopenharmony_ci
318370b324cSopenharmony_ci  // GetButton_Bools(IDX_EXTRACT_ALT_STREAMS, AltStreams, _info.AltStreams);
319370b324cSopenharmony_ci  GetButton_Bools(IDX_EXTRACT_NT_SECUR,    NtSecurity, _info.NtSecurity);
320370b324cSopenharmony_ci  GetButton_Bools(IDX_EXTRACT_ELIM_DUP,    ElimDup,    _info.ElimDup);
321370b324cSopenharmony_ci
322370b324cSopenharmony_ci  bool showPassword = IsShowPasswordChecked();
323370b324cSopenharmony_ci  if (showPassword != _info.ShowPassword.Val)
324370b324cSopenharmony_ci  {
325370b324cSopenharmony_ci    _info.ShowPassword.Def = true;
326370b324cSopenharmony_ci    _info.ShowPassword.Val = showPassword;
327370b324cSopenharmony_ci  }
328370b324cSopenharmony_ci
329370b324cSopenharmony_ci  if (_info.PathMode != pathMode2)
330370b324cSopenharmony_ci  {
331370b324cSopenharmony_ci    _info.PathMode_Force = true;
332370b324cSopenharmony_ci    _info.PathMode = (NExtract::NPathMode::EEnum)pathMode2;
333370b324cSopenharmony_ci    /*
334370b324cSopenharmony_ci    // we allow kAbsPaths in registry.
335370b324cSopenharmony_ci    if (_info.PathMode == NExtract::NPathMode::kAbsPaths)
336370b324cSopenharmony_ci      _info.PathMode = NExtract::NPathMode::kFullPaths;
337370b324cSopenharmony_ci    */
338370b324cSopenharmony_ci  }
339370b324cSopenharmony_ci
340370b324cSopenharmony_ci  if (!OverwriteMode_Force && _info.OverwriteMode != OverwriteMode)
341370b324cSopenharmony_ci    _info.OverwriteMode_Force = true;
342370b324cSopenharmony_ci  _info.OverwriteMode = OverwriteMode;
343370b324cSopenharmony_ci
344370b324cSopenharmony_ci
345370b324cSopenharmony_ci  #else
346370b324cSopenharmony_ci
347370b324cSopenharmony_ci  ElimDup.Val = IsButtonCheckedBool(IDX_EXTRACT_ELIM_DUP);
348370b324cSopenharmony_ci
349370b324cSopenharmony_ci  #endif
350370b324cSopenharmony_ci
351370b324cSopenharmony_ci  UString s;
352370b324cSopenharmony_ci
353370b324cSopenharmony_ci  #ifdef Z7_NO_REGISTRY
354370b324cSopenharmony_ci
355370b324cSopenharmony_ci  _path.GetText(s);
356370b324cSopenharmony_ci
357370b324cSopenharmony_ci  #else
358370b324cSopenharmony_ci
359370b324cSopenharmony_ci  int currentItem = _path.GetCurSel();
360370b324cSopenharmony_ci  if (currentItem == CB_ERR)
361370b324cSopenharmony_ci  {
362370b324cSopenharmony_ci    _path.GetText(s);
363370b324cSopenharmony_ci    if (_path.GetCount() >= (int)kHistorySize)
364370b324cSopenharmony_ci      currentItem = _path.GetCount() - 1;
365370b324cSopenharmony_ci  }
366370b324cSopenharmony_ci  else
367370b324cSopenharmony_ci    _path.GetLBText(currentItem, s);
368370b324cSopenharmony_ci
369370b324cSopenharmony_ci  #endif
370370b324cSopenharmony_ci
371370b324cSopenharmony_ci  s.Trim();
372370b324cSopenharmony_ci  NName::NormalizeDirPathPrefix(s);
373370b324cSopenharmony_ci
374370b324cSopenharmony_ci  #ifndef Z7_SFX
375370b324cSopenharmony_ci
376370b324cSopenharmony_ci  const bool splitDest = IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE);
377370b324cSopenharmony_ci  if (splitDest)
378370b324cSopenharmony_ci  {
379370b324cSopenharmony_ci    UString pathName;
380370b324cSopenharmony_ci    _pathName.GetText(pathName);
381370b324cSopenharmony_ci    pathName.Trim();
382370b324cSopenharmony_ci    s += pathName;
383370b324cSopenharmony_ci    NName::NormalizeDirPathPrefix(s);
384370b324cSopenharmony_ci  }
385370b324cSopenharmony_ci  if (splitDest != _info.SplitDest.Val)
386370b324cSopenharmony_ci  {
387370b324cSopenharmony_ci    _info.SplitDest.Def = true;
388370b324cSopenharmony_ci    _info.SplitDest.Val = splitDest;
389370b324cSopenharmony_ci  }
390370b324cSopenharmony_ci
391370b324cSopenharmony_ci  #endif
392370b324cSopenharmony_ci
393370b324cSopenharmony_ci  DirPath = s;
394370b324cSopenharmony_ci
395370b324cSopenharmony_ci  #ifndef Z7_NO_REGISTRY
396370b324cSopenharmony_ci  _info.Paths.Clear();
397370b324cSopenharmony_ci  #ifndef Z7_SFX
398370b324cSopenharmony_ci  AddUniqueString(_info.Paths, s);
399370b324cSopenharmony_ci  #endif
400370b324cSopenharmony_ci  for (int i = 0; i < _path.GetCount(); i++)
401370b324cSopenharmony_ci    if (i != currentItem)
402370b324cSopenharmony_ci    {
403370b324cSopenharmony_ci      UString sTemp;
404370b324cSopenharmony_ci      _path.GetLBText(i, sTemp);
405370b324cSopenharmony_ci      sTemp.Trim();
406370b324cSopenharmony_ci      AddUniqueString(_info.Paths, sTemp);
407370b324cSopenharmony_ci    }
408370b324cSopenharmony_ci  _info.Save();
409370b324cSopenharmony_ci  #endif
410370b324cSopenharmony_ci
411370b324cSopenharmony_ci  CModalDialog::OnOK();
412370b324cSopenharmony_ci}
413370b324cSopenharmony_ci
414370b324cSopenharmony_ci#ifndef Z7_NO_REGISTRY
415370b324cSopenharmony_ci#define kHelpTopic "fm/plugins/7-zip/extract.htm"
416370b324cSopenharmony_civoid CExtractDialog::OnHelp()
417370b324cSopenharmony_ci{
418370b324cSopenharmony_ci  ShowHelpWindow(kHelpTopic);
419370b324cSopenharmony_ci  CModalDialog::OnHelp();
420370b324cSopenharmony_ci}
421370b324cSopenharmony_ci#endif
422