00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "DownloaderProperties_MonitorPage.h"
00009 #include "DownloadsWnd.h"
00010 #include "DlgCustomizeIEMenu.h"
00011 #include "vmsFirefoxMonitoring.h"
00012 #include "DownloaderProperties_MonitorPage_SkipList.h"
00013
00014 extern CDownloadsWnd* _pwndDownloads;
00015
00016 #ifdef _DEBUG
00017 #define new DEBUG_NEW
00018 #undef THIS_FILE
00019 static char THIS_FILE[] = __FILE__;
00020 #endif
00021
00022 IMPLEMENT_DYNCREATE(CDownloaderProperties_MonitorPage, CPropertyPage)
00023
00024 CDownloaderProperties_MonitorPage::CDownloaderProperties_MonitorPage() : CPropertyPage(CDownloaderProperties_MonitorPage::IDD)
00025 {
00026 m_psp.dwFlags |= PSP_USETITLE;
00027 m_psp.pszTitle = LS (L_MONITOR);
00028 }
00029
00030 CDownloaderProperties_MonitorPage::~CDownloaderProperties_MonitorPage()
00031 {
00032 }
00033
00034 void CDownloaderProperties_MonitorPage::DoDataExchange(CDataExchange* pDX)
00035 {
00036 CPropertyPage::DoDataExchange(pDX);
00037
00038
00039
00040 }
00041
00042 BEGIN_MESSAGE_MAP(CDownloaderProperties_MonitorPage, CPropertyPage)
00043
00044 ON_WM_CONTEXTMENU()
00045 ON_COMMAND(ID_WHATISTHIS, OnWhatisthis)
00046 ON_BN_CLICKED(IDC_CLIPBOARD, OnClipboard)
00047 ON_BN_CLICKED(IDC_ALTPRESSED, OnAltpressed)
00048 ON_BN_CLICKED(IDC_ADDTOIEMENU, OnAddtoiemenu)
00049 ON_BN_CLICKED(IDC_OPERA, OnOpera)
00050 ON_BN_CLICKED(IDC_NETSCAPE, OnNetscape)
00051 ON_WM_HELPINFO()
00052 ON_BN_CLICKED(IDC_IE2, OnIe2)
00053 ON_BN_CLICKED(IDC_ALLOWIETODL, OnAllowietodl)
00054 ON_BN_CLICKED(IDC_FIREFOX, OnFirefox)
00055 ON_BN_CLICKED(IDC_SILENT, OnSilent)
00056 ON_BN_CLICKED(IDC_CUSTOMIZE, OnCustomize)
00057 ON_BN_CLICKED(IDC_DONTMONSMALL, OnDontmonsmall)
00058 ON_EN_CHANGE(IDC_SMALLSIZE, OnChangeSmallsize)
00059 ON_BN_CLICKED(IDC_MOZILLA, OnMozilla)
00060 ON_BN_CLICKED(IDC_SKIPLIST, OnSkiplist)
00061
00062 END_MESSAGE_MAP()
00063
00064 BOOL CDownloaderProperties_MonitorPage::OnInitDialog()
00065 {
00066 CPropertyPage::OnInitDialog();
00067
00068 BOOL bIE2 = _IECatchMgr.IsIE2Active ();
00069
00070 CheckDlgButton (IDC_IE2, bIE2 ? BST_CHECKED : BST_UNCHECKED);
00071 CheckDlgButton (IDC_CLIPBOARD, _App.Monitor_Clipboard () ? BST_CHECKED : BST_UNCHECKED);
00072
00073 BOOL bFF = _App.Monitor_Firefox () && vmsFirefoxMonitoring::IsInstalled () &&
00074 vmsFirefoxMonitoring::IsFlashGotInstalled () == false;
00075 CheckDlgButton (IDC_FIREFOX, bFF ? BST_CHECKED : BST_UNCHECKED);
00076
00077
00078 _IECMM.ReadState ();
00079 m_bIEMenuWas = _IECMM.IsIEMenusPresent ();
00080 CheckDlgButton (IDC_ADDTOIEMENU,
00081 (m_bIEMenuWas || _App.Monitor_IEMenu_Enable ()) ? BST_CHECKED : BST_UNCHECKED);
00082
00083 CheckDlgButton (IDC_ALTPRESSED, _App.Monitor_ALTShouldPressed () ? BST_CHECKED : BST_UNCHECKED);
00084
00085 CheckDlgButton (IDC_ALLOWIETODL, _App.Monitor_AllowDownload () ? BST_CHECKED : BST_UNCHECKED);
00086
00087 CheckDlgButton (IDC_OPERA, _NOMgr.IsOperaPluginInstalled () ? BST_CHECKED : BST_UNCHECKED);
00088 CheckDlgButton (IDC_NETSCAPE, _NOMgr.IsNetscapePluginInstalled () ? BST_CHECKED : BST_UNCHECKED);
00089 CheckDlgButton (IDC_MOZILLA, _NOMgr.IsMozillaSuitePluginInstalled () ? BST_CHECKED : BST_UNCHECKED);
00090
00091 CheckDlgButton (IDC_SILENT, _App.Monitor_Silent () ? BST_CHECKED : BST_UNCHECKED);
00092
00093 int iSize = _App.Monitor_SkipSmaller ();
00094 CheckDlgButton (IDC_DONTMONSMALL, iSize == 0 ? BST_UNCHECKED : BST_CHECKED);
00095 SetDlgItemInt (IDC_SMALLSIZE, iSize ? iSize/1000 : 10);
00096
00097 ApplyLanguage ();
00098 UpdateEnabled ();
00099
00100 return TRUE;
00101 }
00102
00103 BOOL CDownloaderProperties_MonitorPage::OnApply()
00104 {
00105 BOOL bIE2 = FALSE;
00106
00107 DWORD dwMUSO = 0;
00108
00109 bIE2 = IsDlgButtonChecked (IDC_IE2) == BST_CHECKED;
00110
00111 _App.Monitor_IE1 ( FALSE);
00112
00113 BOOL bIE2Active = _IECatchMgr.IsIE2Active ();
00114
00115 BOOL bRR = FALSE;
00116
00117 BOOL bFF = IsDlgButtonChecked (IDC_FIREFOX) == BST_CHECKED;
00118 if (bFF && vmsFirefoxMonitoring::IsInstalled () == false)
00119 {
00120 if (vmsFirefoxMonitoring::Install (true) == false)
00121 {
00122 MessageBox (LS (L_CANTINITFFMONITOR), LS (L_ERR), MB_ICONERROR);
00123 CheckDlgButton (IDC_FIREFOX, BST_UNCHECKED);
00124 bFF = FALSE;
00125 }
00126 }
00127 if (bFF && vmsFirefoxMonitoring::IsFlashGotInstalled ())
00128 {
00129 MessageBox (LS (L_FLASHGOTDETECTED), PRG_NAME, MB_ICONWARNING);
00130 CheckDlgButton (IDC_FIREFOX, BST_UNCHECKED);
00131 bFF = FALSE;
00132 }
00133 if (bFF)
00134 dwMUSO |= MONITOR_USERSWITCHEDON_FIREFOX;
00135 _App.Monitor_Firefox (bFF);
00136 if (bFF)
00137 vmsFirefoxMonitoring::Install (true);
00138
00139
00140 if ((bIE2 == FALSE && bIE2Active) || (bIE2 && bIE2Active == FALSE))
00141 {
00142 if (bIE2 && _IECatchMgr.IsMonitoringDllRegistered () == FALSE)
00143 {
00144 if (_IECatchMgr.ActivateIE2 (TRUE) == FALSE)
00145 {
00146 MessageBox (LS (L_ERRIE), LS (L_ERR), MB_ICONERROR);
00147 CheckDlgButton (IDC_IE2, bIE2Active ? BST_CHECKED : BST_UNCHECKED);
00148 }
00149 else
00150 bRR = TRUE;
00151 }
00152 else
00153 {
00154 _App.Monitor_IE2 (bIE2);
00155 }
00156 }
00157 if (bIE2)
00158 dwMUSO |= MONITOR_USERSWITCHEDON_IE;
00159
00160 BOOL b = IsDlgButtonChecked (IDC_ADDTOIEMENU) == BST_CHECKED;
00161 if (b)
00162 _IECMM.AddIEMenus ();
00163 else
00164 _IECMM.DeleteIEMenus ();
00165 _App.Monitor_IEMenu_Enable (b);
00166 if (b != m_bIEMenuWas)
00167 {
00168 bRR = TRUE;
00169 m_bIEMenuWas = b;
00170 }
00171
00172 b = IsDlgButtonChecked (IDC_CLIPBOARD) == BST_CHECKED;
00173 _App.Monitor_Clipboard (b);
00174 _pwndDownloads->m_ClpbrdCatch.Enable (b);
00175
00176 _App.Monitor_ALTShouldPressed (IsDlgButtonChecked (IDC_ALTPRESSED) == BST_CHECKED);
00177 _App.Monitor_AllowDownload (IsDlgButtonChecked (IDC_ALLOWIETODL) == BST_CHECKED);
00178
00179 _IECatchMgr.ReadSettings ();
00180
00181 CString strOpDir = _App.Monitor_OperaPDInstalledTo ();
00182 CString strNDir = _App.Monitor_NetscapePDInstalledTo ();
00183 CString strMozDir = _App.Monitor_MozillaSuitePDInstalledTo ();
00184
00185 if (IsDlgButtonChecked (IDC_OPERA) == BST_CHECKED)
00186 {
00187 dwMUSO |= MONITOR_USERSWITCHEDON_OPERA;
00188
00189 if (_NOMgr.IsOperaPluginInstalled (TRUE) == FALSE)
00190 {
00191 if (FALSE == _NOMgr.InstallOperaPlugin ())
00192 {
00193 MessageBox (LS (L_CANTINITOPMONITOR), LS (L_ERR), MB_ICONERROR);
00194 CheckDlgButton (IDC_OPERA, BST_UNCHECKED);
00195 }
00196 else
00197 bRR = TRUE;
00198 }
00199 }
00200 else if (_NOMgr.IsOperaPluginInstalled (strOpDir.GetLength ()))
00201 {
00202 if (FALSE == _NOMgr.DeinstallOperaPlugin ())
00203 {
00204 MessageBox (LS (L_CANTDEINITOPMONITOR), LS (L_ERR), MB_ICONERROR);
00205 CheckDlgButton (IDC_OPERA, BST_CHECKED);
00206 }
00207 else
00208 bRR = TRUE;
00209 }
00210
00211 if (IsDlgButtonChecked (IDC_NETSCAPE) == BST_CHECKED)
00212 {
00213 dwMUSO |= MONITOR_USERSWITCHEDON_NETSCAPE;
00214
00215 if (_NOMgr.IsNetscapePluginInstalled (TRUE) == FALSE)
00216 {
00217 if (FALSE == _NOMgr.InstallNetscapePlugin ())
00218 {
00219 MessageBox (LS (L_CANTINITNETMONITOR), LS (L_ERR), MB_ICONERROR);
00220 CheckDlgButton (IDC_NETSCAPE, BST_UNCHECKED);
00221 }
00222 else
00223 bRR = TRUE;
00224 }
00225 }
00226 else if (_NOMgr.IsNetscapePluginInstalled (strNDir.GetLength ()))
00227 {
00228 if (FALSE == _NOMgr.DeinstallNetscapePlugin ())
00229 {
00230 MessageBox (LS (L_CANTDEINITNETMONITOR), LS (L_ERR), MB_ICONERROR);
00231 CheckDlgButton (IDC_NETSCAPE, BST_CHECKED);
00232 }
00233 else
00234 bRR = TRUE;
00235 }
00236
00237 if (IsDlgButtonChecked (IDC_MOZILLA) == BST_CHECKED)
00238 {
00239 dwMUSO |= MONITOR_USERSWITCHEDON_SEAMONKEY;
00240
00241 if (_NOMgr.IsMozillaSuitePluginInstalled (TRUE) == FALSE)
00242 {
00243 if (FALSE == _NOMgr.InstallMozillaSuitePlugin ())
00244 {
00245 MessageBox (LS (L_CANTINITMOZMONITOR), LS (L_ERR), MB_ICONERROR);
00246 CheckDlgButton (IDC_MOZILLA, BST_UNCHECKED);
00247 }
00248 else
00249 bRR = TRUE;
00250 }
00251 }
00252 else if (_NOMgr.IsMozillaSuitePluginInstalled (strMozDir.GetLength ()))
00253 {
00254 if (FALSE == _NOMgr.DeinstallMozillaSuitePlugin ())
00255 {
00256 MessageBox (LS (L_CANTDEINITMOZMONITOR), LS (L_ERR), MB_ICONERROR);
00257 CheckDlgButton (IDC_MOZILLA, BST_CHECKED);
00258 }
00259 else
00260 bRR = TRUE;
00261 }
00262
00263 _App.Monitor_UserSwitchedOn (dwMUSO);
00264
00265 _App.Monitor_Silent (IsDlgButtonChecked (IDC_SILENT) == BST_CHECKED);
00266 int iSize = 0;
00267 if (IsDlgButtonChecked (IDC_DONTMONSMALL) == BST_CHECKED)
00268 iSize = GetDlgItemInt (IDC_SMALLSIZE);
00269 _App.Monitor_SkipSmaller (iSize*1000);
00270
00271 if (bRR)
00272 MessageBox (LS (L_BROWSERRESTARTREQ));
00273
00274 UpdateEnabled ();
00275
00276 return CPropertyPage::OnApply();
00277 }
00278
00279 void CDownloaderProperties_MonitorPage::OnContextMenu(CWnd* , CPoint point)
00280 {
00281 PrepareCHMgr (point);
00282 _CHMgr.ShowMenu ();
00283 }
00284
00285 void CDownloaderProperties_MonitorPage::OnWhatisthis()
00286 {
00287 _CHMgr.OnWT ();
00288 }
00289
00290 void CDownloaderProperties_MonitorPage::OnClipboard()
00291 {
00292 SetModified ();
00293 UpdateEnabled ();
00294 }
00295
00296 void CDownloaderProperties_MonitorPage::OnAltpressed()
00297 {
00298 SetModified ();
00299 }
00300
00301 void CDownloaderProperties_MonitorPage::ApplyLanguage()
00302 {
00303 fsDlgLngInfo lnginfo [] = {
00304 fsDlgLngInfo (IDC__MONITORFOR, L_MONITORFOR),
00305 fsDlgLngInfo (IDC_CLIPBOARD, L_CLIPBOARD),
00306 fsDlgLngInfo (IDC_ADDTOIEMENU, L_ADDTOBRMENU),
00307 fsDlgLngInfo (IDC_ALTPRESSED, L_ALTSHOULD),
00308 fsDlgLngInfo (IDC_ALLOWIETODL, L_ALLOWBRTODL),
00309 fsDlgLngInfo (IDC_SILENT, L_SILENTMONITORING),
00310 fsDlgLngInfo (IDC_CUSTOMIZE, L_CUSTOMIZE),
00311 fsDlgLngInfo (IDC_DONTMONSMALL, L_DONTMONSMALL),
00312 fsDlgLngInfo (IDC__KBYTES, L_KBYTES),
00313 fsDlgLngInfo (IDC_SKIPLIST, L_SKIPLIST),
00314 };
00315
00316 _LngMgr.ApplyLanguage (this, lnginfo, sizeof (lnginfo) / sizeof (fsDlgLngInfo), 0);
00317 }
00318
00319 void CDownloaderProperties_MonitorPage::OnAddtoiemenu()
00320 {
00321 SetModified ();
00322 UpdateEnabled ();
00323 }
00324
00325 void CDownloaderProperties_MonitorPage::OnOpera()
00326 {
00327 SetModified ();
00328 }
00329
00330 void CDownloaderProperties_MonitorPage::OnNetscape()
00331 {
00332 SetModified ();
00333 }
00334
00335 void CDownloaderProperties_MonitorPage::PrepareCHMgr(CPoint point)
00336 {
00337 fsCtrlContextHelp aCH1 [] = {
00338 fsCtrlContextHelp (IDC_ADDTOIEMENU, LS (L_ADDTOBRMENUHERE)),
00339 fsCtrlContextHelp (IDC_CLIPBOARD, LS (L_CLIPBOARDHERE)),
00340 fsCtrlContextHelp (IDC_ALTPRESSED, LS (L_ALTSHOULDHERE)),
00341 fsCtrlContextHelp (IDC_OPERA, LS (L_OPERAHERE)),
00342 fsCtrlContextHelp (IDC_NETSCAPE, LS (L_NETSCAPEHERE)),
00343 fsCtrlContextHelp (IDC_FIREFOX, LS (L_FIREFOXHERE2)),
00344 fsCtrlContextHelp (IDC_IE2, LS (L_IEXPLOREHERE)),
00345 fsCtrlContextHelp (IDC_ALLOWIETODL, LS (L_ALLOWBRDLHERE)),
00346 fsCtrlContextHelp (IDC_SILENT, LS (L_SILENTMONITORINGHERE)),
00347 fsCtrlContextHelp (IDC_CUSTOMIZE, LS (L_CUSTOMIZEBRMENUHERE)),
00348 fsCtrlContextHelp (IDC_DONTMONSMALL, LS (L_DONTMONSMALLHERE)),
00349 fsCtrlContextHelp (IDC_MOZILLA, LS (L_SEAMONKEYHERE)),
00350 fsCtrlContextHelp (IDC_SKIPLIST, LS (L_SKIPLIST_HERE)),
00351 };
00352
00353 static fsCtrlContextHelp aCH [sizeof (aCH1) / sizeof (fsCtrlContextHelp)];
00354 CopyMemory (aCH, aCH1, sizeof (aCH));
00355
00356 _CHMgr.PrepareContextMenu (this, point, aCH, sizeof (aCH) / sizeof (fsCtrlContextHelp));
00357 }
00358
00359 BOOL CDownloaderProperties_MonitorPage::OnHelpInfo(HELPINFO* pHelpInfo)
00360 {
00361 RECT rc;
00362 CWnd *pItem = GetDlgItem (pHelpInfo->iCtrlId);
00363 if (pItem == NULL)
00364 return TRUE;
00365 pItem->GetWindowRect (&rc);
00366 if (PtInRect (&rc, pHelpInfo->MousePos) == FALSE)
00367 {
00368 pHelpInfo->MousePos.x = rc.left + (rc.right - rc.left) / 2;
00369 pHelpInfo->MousePos.y = rc.top + (rc.bottom - rc.top) / 2;
00370 }
00371 PrepareCHMgr (pHelpInfo->MousePos);
00372 _CHMgr.OnWT ();
00373 return TRUE;
00374 }
00375
00376 void CDownloaderProperties_MonitorPage::OnIe2()
00377 {
00378 SetModified ();
00379 UpdateEnabled ();
00380 }
00381
00382 void CDownloaderProperties_MonitorPage::UpdateEnabled()
00383 {
00384 BOOL bIE = IsDlgButtonChecked (IDC_IE2) == BST_CHECKED ||
00385 IsDlgButtonChecked (IDC_FIREFOX) == BST_CHECKED;
00386
00387 GetDlgItem (IDC_ALTPRESSED)->EnableWindow (bIE);
00388 GetDlgItem (IDC_ALLOWIETODL)->EnableWindow (bIE);
00389 GetDlgItem (IDC_DONTMONSMALL)->EnableWindow (bIE);
00390
00391 BOOL b = bIE || IsDlgButtonChecked (IDC_CLIPBOARD) == BST_CHECKED;
00392 GetDlgItem (IDC_SKIPLIST)->EnableWindow (b);
00393
00394 GetDlgItem (IDC_CUSTOMIZE)->EnableWindow (
00395 IsDlgButtonChecked (IDC_ADDTOIEMENU) == BST_CHECKED);
00396
00397 b = bIE && IsDlgButtonChecked (IDC_DONTMONSMALL) == BST_CHECKED;
00398 GetDlgItem (IDC_SMALLSIZE)->EnableWindow (b);
00399 GetDlgItem (IDC__KBYTES)->EnableWindow (b);
00400 }
00401
00402 void CDownloaderProperties_MonitorPage::OnAllowietodl()
00403 {
00404 SetModified ();
00405 }
00406
00407 void CDownloaderProperties_MonitorPage::OnFirefox()
00408 {
00409 UpdateEnabled ();
00410 SetModified ();
00411 }
00412
00413 void CDownloaderProperties_MonitorPage::OnSilent()
00414 {
00415 SetModified ();
00416 }
00417
00418 void CDownloaderProperties_MonitorPage::OnCustomize()
00419 {
00420 CDlgCustomizeIEMenu dlg;
00421 _DlgMgr.DoModal (&dlg);
00422 }
00423
00424 void CDownloaderProperties_MonitorPage::OnDontmonsmall()
00425 {
00426 SetModified ();
00427 UpdateEnabled ();
00428 }
00429
00430 void CDownloaderProperties_MonitorPage::OnChangeSmallsize()
00431 {
00432 SetModified ();
00433 }
00434
00435 void CDownloaderProperties_MonitorPage::OnMozilla()
00436 {
00437 SetModified ();
00438 }
00439
00440 void CDownloaderProperties_MonitorPage::OnSkiplist()
00441 {
00442 CDownloaderProperties_MonitorPage_SkipList dlg;
00443 _DlgMgr.DoModal (&dlg);
00444 }