• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // UpdateCallbackGUI2.cpp
2 
3 #include "StdAfx.h"
4 
5 #include "../FileManager/LangUtils.h"
6 #include "../FileManager/PasswordDialog.h"
7 
8 #include "resource2.h"
9 #include "resource3.h"
10 #include "ExtractRes.h"
11 
12 #include "UpdateCallbackGUI.h"
13 
14 using namespace NWindows;
15 
16 static const UINT k_UpdNotifyLangs[] =
17 {
18   IDS_PROGRESS_ADD,
19   IDS_PROGRESS_UPDATE,
20   IDS_PROGRESS_ANALYZE,
21   IDS_PROGRESS_REPLICATE,
22   IDS_PROGRESS_REPACK,
23   IDS_PROGRESS_SKIPPING,
24   IDS_PROGRESS_DELETE,
25   IDS_PROGRESS_HEADER
26 };
27 
Init()28 void CUpdateCallbackGUI2::Init()
29 {
30   NumFiles = 0;
31 
32   _lang_Removing = LangString(IDS_PROGRESS_REMOVE);
33   _lang_Ops.Clear();
34   for (unsigned i = 0; i < Z7_ARRAY_SIZE(k_UpdNotifyLangs); i++)
35     _lang_Ops.Add(LangString(k_UpdNotifyLangs[i]));
36 }
37 
SetOperation_Base(UInt32 notifyOp,const wchar_t * name,bool isDir)38 HRESULT CUpdateCallbackGUI2::SetOperation_Base(UInt32 notifyOp, const wchar_t *name, bool isDir)
39 {
40   const UString *s = NULL;
41   if (notifyOp < _lang_Ops.Size())
42     s = &(_lang_Ops[(unsigned)notifyOp]);
43   else
44     s = &_emptyString;
45 
46   return ProgressDialog->Sync.Set_Status2(*s, name, isDir);
47 }
48 
49 
ShowAskPasswordDialog()50 HRESULT CUpdateCallbackGUI2::ShowAskPasswordDialog()
51 {
52   CPasswordDialog dialog;
53   ProgressDialog->WaitCreating();
54   if (dialog.Create(*ProgressDialog) != IDOK)
55     return E_ABORT;
56   Password = dialog.Password;
57   PasswordIsDefined = true;
58   return S_OK;
59 }
60