2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
15 #include "TaAfsUsrMgr.h"
20 * DEFINITIONS ________________________________________________________________
24 #define cminREFRESH_MIN 1 // 15 minutes
25 #define cminREFRESH_DEFAULT 60 // 1 hour
26 #define cminREFRESH_MAX 10080 // 1 week
30 * PROTOTYPES _________________________________________________________________
34 BOOL CALLBACK Options_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
35 void Options_OnInitDialog (HWND hDlg);
36 void Options_OnApply (HWND hDlg);
40 * ROUTINES ___________________________________________________________________
44 void ShowOptionsDialog (HWND hParent)
46 LPPROPSHEET psh = PropSheet_Create (IDS_OPTIONS_TITLE, TRUE, hParent, (LPARAM)0);
47 PropSheet_AddTab (psh, 0, IDD_OPTIONS, (DLGPROC)Options_DlgProc, (LPARAM)0, TRUE, TRUE);
48 PropSheet_ShowModal (psh);
52 BOOL CALLBACK Options_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
54 if (AfsAppLib_HandleHelp (IDD_OPTIONS, hDlg, msg, wp, lp))
60 Options_OnInitDialog (hDlg);
67 Options_OnApply (hDlg);
71 EnableWindow (GetDlgItem (hDlg, IDC_REFRESH_RATE), IsDlgButtonChecked (hDlg, IDC_REFRESH));
81 void Options_OnInitDialog (HWND hDlg)
83 CheckDlgButton (hDlg, IDC_REGEXP_UNIX, !gr.fWindowsRegexp);
84 CheckDlgButton (hDlg, IDC_REGEXP_WINDOWS, gr.fWindowsRegexp);
86 CheckDlgButton (hDlg, IDC_WARN_BADCREDS, gr.fWarnBadCreds);
88 CheckDlgButton (hDlg, IDC_REFRESH, (gr.cminRefreshRate != 0));
90 DWORD cminShow = (gr.cminRefreshRate != 0) ? gr.cminRefreshRate : cminREFRESH_DEFAULT;
91 CreateSpinner (GetDlgItem (hDlg, IDC_REFRESH_RATE), 10, FALSE, cminREFRESH_MIN, cminShow, cminREFRESH_MAX);
93 EnableWindow (GetDlgItem (hDlg, IDC_REFRESH_RATE), IsDlgButtonChecked (hDlg, IDC_REFRESH));
97 void Options_OnApply (HWND hDlg)
99 gr.fWindowsRegexp = IsDlgButtonChecked (hDlg, IDC_REGEXP_WINDOWS);
101 gr.fWarnBadCreds = IsDlgButtonChecked (hDlg, IDC_WARN_BADCREDS);
103 DWORD cminRateOld = gr.cminRefreshRate;
105 if (!IsDlgButtonChecked (hDlg, IDC_REFRESH))
106 gr.cminRefreshRate = 0;
108 gr.cminRefreshRate = (DWORD) SP_GetPos (GetDlgItem (hDlg, IDC_REFRESH_RATE));
110 if ((cminRateOld != gr.cminRefreshRate) && (g.idCell))
112 StartTask (taskSET_REFRESH);