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>
18 #include "propcache.h"
20 #include "set_general.h"
25 * PROTOTYPES _________________________________________________________________
29 BOOL CALLBACK Options_General_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
30 void Options_General_OnInitDialog (HWND hDlg);
31 void Options_General_OnApply (HWND hDlg);
35 * ROUTINES ___________________________________________________________________
39 void ShowOptionsDialog (void)
41 TCHAR szCell[ cchNAME ];
43 g.lpiCell->GetCellName (szCell);
45 AfsAppLib_GetLocalCell (szCell);
47 LPPROPSHEET psh = PropSheet_Create (IDS_OPTIONS_TITLE, FALSE);
48 psh->sh.hwndParent = g.hMain;
49 PropSheet_AddTab (psh, IDS_OPTIONS_GENERAL_TAB, IDD_OPTIONS_GENERAL, (DLGPROC)Options_General_DlgProc, 0, TRUE);
50 PropSheet_ShowModal (psh, PumpMessage);
54 BOOL CALLBACK Options_General_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
56 if (AfsAppLib_HandleHelp (IDD_OPTIONS_GENERAL, hDlg, msg, wp, lp))
61 case WM_INITDIALOG_SHEET:
62 PropCache_Add (pcGENERAL, 0, hDlg);
65 case WM_DESTROY_SHEET:
66 PropCache_Delete (hDlg);
70 PropCache_Add (pcGENERAL, NULL, hDlg);
71 Options_General_OnInitDialog (hDlg);
78 Options_General_OnApply (hDlg);
81 case IDC_OPT_SVR_LONGNAMES:
82 case IDC_OPT_SVR_DBL_PROP:
83 case IDC_OPT_SVR_DBL_DEPENDS:
84 case IDC_OPT_SVR_DBL_OPEN:
85 case IDC_OPT_SVR_OPENMON:
86 case IDC_OPT_SVR_CLOSEUNMON:
87 case IDC_OPT_WARN_BADCREDS:
88 PropSheetChanged (hDlg);
98 void Options_General_OnInitDialog (HWND hDlg)
100 CheckDlgButton (hDlg, IDC_OPT_SVR_LONGNAMES, (gr.fServerLongNames));
101 CheckDlgButton (hDlg, IDC_OPT_SVR_DBL_PROP, (gr.fDoubleClickOpens == 0));
102 CheckDlgButton (hDlg, IDC_OPT_SVR_DBL_DEPENDS, (gr.fDoubleClickOpens == 2));
103 CheckDlgButton (hDlg, IDC_OPT_SVR_DBL_OPEN, (gr.fDoubleClickOpens == 1));
104 CheckDlgButton (hDlg, IDC_OPT_SVR_OPENMON, (gr.fOpenMonitors));
105 CheckDlgButton (hDlg, IDC_OPT_SVR_CLOSEUNMON, (gr.fCloseUnmonitors));
106 CheckDlgButton (hDlg, IDC_OPT_WARN_BADCREDS, (gr.fWarnBadCreds));
110 void Options_General_OnApply (HWND hDlg)
112 BOOL fServerLongNamesOld = gr.fServerLongNames;
114 gr.fServerLongNames = IsDlgButtonChecked (hDlg, IDC_OPT_SVR_LONGNAMES);
116 if (IsDlgButtonChecked (hDlg, IDC_OPT_SVR_DBL_PROP))
117 gr.fDoubleClickOpens = 0;
118 else if (IsDlgButtonChecked (hDlg, IDC_OPT_SVR_DBL_OPEN))
119 gr.fDoubleClickOpens = 1;
120 else // (IsDlgButtonChecked (hDlg, IDC_OPT_SVR_DBL_DEPENDS))
121 gr.fDoubleClickOpens = 2;
123 gr.fOpenMonitors = IsDlgButtonChecked (hDlg, IDC_OPT_SVR_OPENMON);
124 gr.fCloseUnmonitors = IsDlgButtonChecked (hDlg, IDC_OPT_SVR_CLOSEUNMON);
125 gr.fWarnBadCreds = IsDlgButtonChecked (hDlg, IDC_OPT_WARN_BADCREDS);
127 StoreSettings (REGSTR_SETTINGS_BASE, REGSTR_SETTINGS_PATH, REGVAL_SETTINGS, &gr, sizeof(gr), wVerGLOBALS_RESTORED);
129 if (fServerLongNamesOld != gr.fServerLongNames)
131 AfsClass_RequestLongServerNames (gr.fServerLongNames);
133 // repopulate the list of server names.
134 UpdateDisplay_Servers (FALSE, NULL, 0);
137 if (gr.fWarnBadCreds)
139 if (!CheckCredentials (TRUE)) // user needs new creds?
141 PostMessage (g.hMain, WM_COMMAND, MAKELONG(M_CREDENTIALS,0), 0);