mirror of
https://github.com/reactos/reactos.git
synced 2025-06-26 12:59:44 +00:00
Add the general user properties page. Settings are visible but cannot be changed yet.
svn path=/trunk/; revision=33696
This commit is contained in:
parent
e1ae479d5a
commit
d53c67dc50
6 changed files with 1006 additions and 821 deletions
|
@ -41,8 +41,16 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
|
|||
CAPTION "General"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "", IDC_USER_NAME, 7, 7, 112, 8
|
||||
|
||||
LTEXT "", IDC_USER_GENERAL_NAME, 7, 7, 112, 8
|
||||
LTEXT "Full name:", -1, 7, 46, 63, 8
|
||||
EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL
|
||||
LTEXT "Description:", -1, 7, 64, 63, 8
|
||||
EDITTEXT IDC_USER_GENERAL_DESCRIPTION,77,61,168,13,ES_AUTOHSCROLL
|
||||
AUTOCHECKBOX "User must change the password upon first logon",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10
|
||||
AUTOCHECKBOX "User cannot change the password",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10
|
||||
AUTOCHECKBOX "Password never expires",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10
|
||||
AUTOCHECKBOX "Account is disabled",IDC_USER_GENERAL_DISABLED,7,121,210,10
|
||||
AUTOCHECKBOX "Account is locked",IDC_USER_GENERAL_LOCKED,7,134,210,10,WS_DISABLED
|
||||
END
|
||||
|
||||
|
||||
|
@ -131,7 +139,7 @@ BEGIN
|
|||
MENUITEM "Delete", IDM_USER_DELETE
|
||||
MENUITEM "Rename", IDM_USER_RENAME
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Properties", IDM_USER_PROPERTIES, GRAYED
|
||||
MENUITEM "Properties", IDM_USER_PROPERTIES
|
||||
END
|
||||
END
|
||||
|
||||
|
|
|
@ -36,14 +36,14 @@
|
|||
/* Dialogs */
|
||||
|
||||
#define IDD_USER_GENERAL 310
|
||||
#define IDC_USER_NAME 311
|
||||
#define IDC_USER_FULLNAME 312
|
||||
#define IDC_USER_DESCRIPTION 313
|
||||
#define IDC_USER_PW_CHANGE 314
|
||||
#define IDC_USER_PW_NOCHANGE 315
|
||||
#define IDC_USER_PW_EXPIRE 316
|
||||
#define IDC_USER_DEACTIVATE 317
|
||||
#define IDC_USER_LOCK 318
|
||||
#define IDC_USER_GENERAL_NAME 311
|
||||
#define IDC_USER_GENERAL_FULL_NAME 312
|
||||
#define IDC_USER_GENERAL_DESCRIPTION 313
|
||||
#define IDC_USER_GENERAL_FORCE_CHANGE 314
|
||||
#define IDC_USER_GENERAL_CANNOT_CHANGE 315
|
||||
#define IDC_USER_GENERAL_NEVER_EXPIRES 316
|
||||
#define IDC_USER_GENERAL_DISABLED 317
|
||||
#define IDC_USER_GENERAL_LOCKED 318
|
||||
|
||||
|
||||
#define IDD_CHANGE_PASSWORD 350
|
||||
|
|
167
reactos/dll/cpl/usrmgr/userprops.c
Normal file
167
reactos/dll/cpl/usrmgr/userprops.c
Normal file
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS User Manager Control Panel
|
||||
* FILE: dll/cpl/usrmgr/users.c
|
||||
* PURPOSE: Users property page
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
*/
|
||||
|
||||
#include "usrmgr.h"
|
||||
|
||||
static VOID
|
||||
UpdateUserOptions(HWND hwndDlg,
|
||||
PUSER_INFO_3 userInfo,
|
||||
BOOL bInit)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_CANNOT_CHANGE),
|
||||
!userInfo->usri3_password_expired);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_NEVER_EXPIRES),
|
||||
!userInfo->usri3_password_expired);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_USER_GENERAL_FORCE_CHANGE),
|
||||
(userInfo->usri3_flags & (UF_PASSWD_CANT_CHANGE | UF_DONT_EXPIRE_PASSWD)) == 0);
|
||||
|
||||
if (bInit)
|
||||
{
|
||||
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_FORCE_CHANGE,
|
||||
userInfo->usri3_password_expired ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_CANNOT_CHANGE,
|
||||
(userInfo->usri3_flags & UF_PASSWD_CANT_CHANGE) ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_NEVER_EXPIRES,
|
||||
(userInfo->usri3_flags & UF_DONT_EXPIRE_PASSWD) ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
CheckDlgButton(hwndDlg, IDC_USER_GENERAL_DISABLED,
|
||||
(userInfo->usri3_flags & UF_ACCOUNTDISABLE) ? BST_CHECKED : BST_UNCHECKED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
GetUserData(HWND hwndDlg, LPTSTR lpUserName, PUSER_INFO_3 *usrInfo)
|
||||
{
|
||||
PUSER_INFO_3 userInfo = NULL;
|
||||
|
||||
SetDlgItemText(hwndDlg, IDC_USER_GENERAL_NAME, lpUserName);
|
||||
|
||||
NetUserGetInfo(NULL, lpUserName, 3, (LPBYTE*)&userInfo);
|
||||
|
||||
SetDlgItemText(hwndDlg, IDC_USER_GENERAL_FULL_NAME, userInfo->usri3_full_name);
|
||||
SetDlgItemText(hwndDlg, IDC_USER_GENERAL_DESCRIPTION, userInfo->usri3_comment);
|
||||
|
||||
UpdateUserOptions(hwndDlg, userInfo, TRUE);
|
||||
|
||||
*usrInfo = userInfo;
|
||||
}
|
||||
|
||||
|
||||
INT_PTR CALLBACK
|
||||
UserGeneralPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
PUSER_INFO_3 userInfo;
|
||||
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
UNREFERENCED_PARAMETER(hwndDlg);
|
||||
|
||||
userInfo = (PUSER_INFO_3)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
GetUserData(hwndDlg,
|
||||
(LPTSTR)((PROPSHEETPAGE *)lParam)->lParam,
|
||||
&userInfo);
|
||||
SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)userInfo);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_USER_GENERAL_FORCE_CHANGE:
|
||||
userInfo->usri3_password_expired = !userInfo->usri3_password_expired;
|
||||
UpdateUserOptions(hwndDlg, userInfo, FALSE);
|
||||
break;
|
||||
|
||||
case IDC_USER_GENERAL_CANNOT_CHANGE:
|
||||
userInfo->usri3_flags ^= UF_PASSWD_CANT_CHANGE;
|
||||
UpdateUserOptions(hwndDlg, userInfo, FALSE);
|
||||
break;
|
||||
|
||||
case IDC_USER_GENERAL_NEVER_EXPIRES:
|
||||
userInfo->usri3_flags ^= UF_DONT_EXPIRE_PASSWD;
|
||||
UpdateUserOptions(hwndDlg, userInfo, FALSE);
|
||||
break;
|
||||
|
||||
case IDC_USER_GENERAL_DISABLED:
|
||||
userInfo->usri3_flags ^= UF_ACCOUNTDISABLE;
|
||||
break;
|
||||
|
||||
case IDC_USER_GENERAL_LOCKED:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
NetApiBufferFree(userInfo);
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPTSTR pszUser)
|
||||
{
|
||||
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
|
||||
psp->dwSize = sizeof(PROPSHEETPAGE);
|
||||
psp->dwFlags = PSP_DEFAULT;
|
||||
psp->hInstance = hApplet;
|
||||
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
|
||||
psp->pfnDlgProc = DlgProc;
|
||||
psp->lParam = (LPARAM)pszUser;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
UserProperties(HWND hwndDlg)
|
||||
{
|
||||
PROPSHEETPAGE psp[1];
|
||||
PROPSHEETHEADER psh;
|
||||
TCHAR szUserName[UNLEN];
|
||||
INT nItem;
|
||||
HWND hwndLV;
|
||||
|
||||
hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST);
|
||||
nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
|
||||
if (nItem == -1)
|
||||
return;
|
||||
|
||||
/* Get the new user name */
|
||||
ListView_GetItemText(hwndLV,
|
||||
nItem, 0,
|
||||
szUserName,
|
||||
UNLEN);
|
||||
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
|
||||
psh.hwndParent = hwndDlg;
|
||||
psh.hInstance = hApplet;
|
||||
psh.hIcon = NULL;
|
||||
psh.pszCaption = szUserName;
|
||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = psp;
|
||||
|
||||
InitPropSheetPage(&psp[0], IDD_USER_GENERAL, (DLGPROC)UserGeneralPageProc, szUserName);
|
||||
// InitPropSheetPage(&psp[1], IDD_USER_MEMBERSHIP, (DLGPROC)UserMembershipPageProc);
|
||||
// InitPropSheetPage(&psp[2], IDD_USER_PROFILE, (DLGPROC)UserProfilePageProc);
|
||||
|
||||
PropertySheet(&psh);
|
||||
}
|
|
@ -11,7 +11,6 @@
|
|||
* TODO:
|
||||
* - Add new user to the users group.
|
||||
* - Remove a user from all groups.
|
||||
* - Implement user property pages.
|
||||
* - Use localized messages.
|
||||
*/
|
||||
|
||||
|
@ -564,15 +563,18 @@ OnNotify(HWND hwndDlg, PUSER_DATA pUserData, NMHDR *phdr)
|
|||
{
|
||||
case NM_CLICK:
|
||||
pUserData->iCurrentItem = lpnmlv->iItem;
|
||||
if (lpnmlv->iItem == -1)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_DBLCLK:
|
||||
if (lpnmlv->iItem != -1)
|
||||
{
|
||||
UINT uItem;
|
||||
|
||||
uItem = GetMenuDefaultItem(GetSubMenu(pUserData->hPopupMenu, 1),
|
||||
FALSE, 0);
|
||||
if (uItem != (UINT)-1)
|
||||
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(uItem, 0), 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
|
@ -615,6 +617,9 @@ UsersPageProc(HWND hwndDlg,
|
|||
pUserData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_USER));
|
||||
|
||||
OnInitDialog(hwndDlg);
|
||||
SetMenuDefaultItem(GetSubMenu(pUserData->hPopupMenu, 1),
|
||||
IDM_USER_PROPERTIES,
|
||||
FALSE);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -641,7 +646,7 @@ UsersPageProc(HWND hwndDlg,
|
|||
break;
|
||||
|
||||
case IDM_USER_PROPERTIES:
|
||||
MessageBeep(-1);
|
||||
UserProperties(hwndDlg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -35,5 +35,9 @@ CheckAccountName(HWND hwndDlg,
|
|||
INT nIdDlgItem,
|
||||
LPTSTR lpAccountName);
|
||||
|
||||
/* userprops.c */
|
||||
VOID
|
||||
UserProperties(HWND hwndDlg);
|
||||
|
||||
#endif /* __CPL_DESK_H__ */
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<file>extra.c</file>
|
||||
<file>groups.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>userprops.c</file>
|
||||
<file>users.c</file>
|
||||
<file>usrmgr.c</file>
|
||||
<file>usrmgr.rc</file>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue