Author: ekohl
Date: Sun Dec 2 17:35:59 2007
New Revision: 30958
URL:
http://svn.reactos.org/svn/reactos?rev=30958&view=rev
Log:
- Add icons for user, locked user and group.
- Enable users to change their name and password (not fully working yet).
- Use the IDI_ prefix for icons.
Added:
trunk/reactos/dll/cpl/usrmgr/resources/group.ico (with props)
trunk/reactos/dll/cpl/usrmgr/resources/locked.ico (with props)
trunk/reactos/dll/cpl/usrmgr/resources/user.ico (with props)
Modified:
trunk/reactos/dll/cpl/usrmgr/groups.c
trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc
trunk/reactos/dll/cpl/usrmgr/resource.h
trunk/reactos/dll/cpl/usrmgr/users.c
trunk/reactos/dll/cpl/usrmgr/usrmgr.c
trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild
trunk/reactos/dll/cpl/usrmgr/usrmgr.rc
Modified: trunk/reactos/dll/cpl/usrmgr/groups.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/groups.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/groups.c (original)
+++ trunk/reactos/dll/cpl/usrmgr/groups.c Sun Dec 2 17:35:59 2007
@@ -29,8 +29,8 @@
GetClientRect(hwndListView, &rect);
memset(&column, 0x00, sizeof(column));
- column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
- column.fmt=LVCFMT_LEFT;
+ column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
+ column.fmt = LVCFMT_LEFT;
column.cx = (INT)((rect.right - rect.left) * 0.40);
column.iSubItem = 0;
LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0]));
Modified: trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/lang/en-US.…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc (original)
+++ trunk/reactos/dll/cpl/usrmgr/lang/en-US.rc Sun Dec 2 17:35:59 2007
@@ -12,7 +12,7 @@
CAPTION "Users"
FONT 8, "MS Shell Dlg"
BEGIN
- CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
+ CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT |
LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER |
WS_TABSTOP,
7, 7, 238, 85, WS_EX_CLIENTEDGE
END
@@ -22,7 +22,7 @@
CAPTION "Groups"
FONT 8, "MS Shell Dlg"
BEGIN
- CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
+ CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT |
LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER |
WS_TABSTOP,
7, 7, 238, 85, WS_EX_CLIENTEDGE
END
@@ -33,6 +33,31 @@
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "This space is intentionally left blank", IDC_STATIC, 66, 90, 112, 8
+END
+
+
+IDD_USER_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223
+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
+
+END
+
+
+
+IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74
+STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Change Password"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL
+ RTEXT "New Password:", -1,7,10,96,8
+ EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL
+ RTEXT "Repeat Password:", -1,7,28,96,8
+ DEFPUSHBUTTON "OK",IDOK,156,53,50,14
+ PUSHBUTTON "Abbrechen",IDCANCEL,210,53,50,14
END
Modified: trunk/reactos/dll/cpl/usrmgr/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/resource.h?…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/resource.h (original)
+++ trunk/reactos/dll/cpl/usrmgr/resource.h Sun Dec 2 17:35:59 2007
@@ -13,10 +13,14 @@
#define ICONSIZE 16
-/* ids */
-#define IDC_USRMGR_ICON 40
-#define IDC_USRMGR_ICON2 100 // Needed for theme compatability with
Windows.
+/* Icons */
+#define IDI_USRMGR_ICON 40
+#define IDI_USRMGR_ICON2 100 // Needed for theme compatibility with
Windows.
+#define IDI_USER 41
+#define IDI_LOCKED_USER 42
+#define IDI_GROUP 43
+
#define IDD_USERS 100
#define IDD_GROUPS 101
@@ -29,6 +33,26 @@
#define IDC_STATIC -1
+/* 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 IDD_CHANGE_PASSWORD 350
+#define IDC_EDIT_PASSWORD1 351
+#define IDC_EDIT_PASSWORD2 352
+
+
+/* Strings */
+
#define IDS_CPLNAME 2000
#define IDS_CPLDESCRIPTION 2001
@@ -36,7 +60,9 @@
#define IDS_FULLNAME 2101
#define IDS_DESCRIPTION 2102
+
/* Menus */
+
#define IDM_POPUP_GROUP 120
#define IDM_GROUP_ADD_MEMBER 121
#define IDM_GROUP_NEW 122
Added: trunk/reactos/dll/cpl/usrmgr/resources/group.ico
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/resources/g…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/dll/cpl/usrmgr/resources/group.ico
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/dll/cpl/usrmgr/resources/locked.ico
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/resources/l…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/dll/cpl/usrmgr/resources/locked.ico
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: trunk/reactos/dll/cpl/usrmgr/resources/user.ico
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/resources/u…
==============================================================================
Binary file - no diff available.
Propchange: trunk/reactos/dll/cpl/usrmgr/resources/user.ico
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: trunk/reactos/dll/cpl/usrmgr/users.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/users.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/users.c (original)
+++ trunk/reactos/dll/cpl/usrmgr/users.c Sun Dec 2 17:35:59 2007
@@ -20,6 +20,69 @@
} USER_DATA, *PUSER_DATA;
+
+static BOOL
+SetPassword(HWND hwndDlg)
+{
+ TCHAR szPassword1[256];
+ TCHAR szPassword2[256];
+ UINT uLen1;
+ UINT uLen2;
+
+ uLen1 = GetDlgItemText(hwndDlg, IDC_EDIT_PASSWORD1, szPassword1, 256);
+ uLen2 = GetDlgItemText(hwndDlg, IDC_EDIT_PASSWORD2, szPassword2, 256);
+
+ /* Check the passwords */
+ if (uLen1 != uLen2 || _tcscmp(szPassword1, szPassword2) != 0)
+ {
+ MessageBox(hwndDlg,
+ TEXT("The passwords you entered are not the same!"),
+ TEXT("ERROR"),
+ MB_OK | MB_ICONERROR);
+ return FALSE;
+ }
+
+
+ return TRUE;
+}
+
+
+INT_PTR CALLBACK
+ChangePasswordDlgProc(HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ UNREFERENCED_PARAMETER(wParam);
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ if (SetPassword(hwndDlg))
+ EndDialog(hwndDlg, 0);
+ break;
+
+ case IDCANCEL:
+ EndDialog(hwndDlg, 0);
+ break;
+ }
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
static VOID
SetUsersListColumns(HWND hwndListView)
{
@@ -120,7 +183,46 @@
}
-static VOID
+static BOOL
+OnEndLabelEdit(LPNMLVDISPINFO pnmv)
+{
+ TCHAR szOldUserName[UNLEN];
+ TCHAR szNewUserName[UNLEN];
+ USER_INFO_0 useri0;
+ NET_API_STATUS status;
+
+ if (pnmv->item.iItem == -1)
+ return FALSE;
+
+ ListView_GetItemText(pnmv->hdr.hwndFrom,
+ pnmv->item.iItem, 0,
+ szOldUserName,
+ UNLEN);
+ lstrcpy(szNewUserName, pnmv->item.pszText);
+
+ if (lstrcmp(szOldUserName, szNewUserName) == 0)
+ return FALSE;
+
+ useri0.usri0_name = szNewUserName;
+
+ status = NetUserSetInfo(NULL, szOldUserName, 0, (LPBYTE)&useri0, NULL);
+ if (status != NERR_Success)
+ {
+ TCHAR szText[256];
+ wsprintf(szText, _T("Error: %u"), status);
+ MessageBox(NULL, szText, _T("NetUserSetInfo"), MB_ICONERROR | MB_OK);
+ return FALSE;
+ }
+
+ ListView_SetItemText(pnmv->hdr.hwndFrom,
+ pnmv->item.iItem, 0,
+ szNewUserName);
+
+ return TRUE;
+}
+
+
+static BOOL
OnNotify(HWND hwndDlg, PUSER_DATA pUserData, NMHDR *phdr)
{
LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;
@@ -143,6 +245,9 @@
case NM_DBLCLK:
break;
+ case LVN_ENDLABELEDIT:
+ return OnEndLabelEdit((LPNMLVDISPINFO)phdr);
+
case NM_RCLICK:
ClientToScreen(GetDlgItem(hwndDlg, IDC_USERS_LIST),
&lpnmlv->ptAction);
TrackPopupMenu(GetSubMenu(pUserData->hPopupMenu, (lpnmlv->iItem
== -1) ? 0 : 1),
@@ -151,6 +256,8 @@
}
break;
}
+
+ return FALSE;
}
@@ -180,6 +287,28 @@
case WM_COMMAND:
switch (LOWORD(wParam))
{
+ case IDM_USER_CHANGE_PASSWORD:
+ DialogBoxParam(hApplet,
+ MAKEINTRESOURCE(IDD_CHANGE_PASSWORD),
+ hwndDlg,
+ ChangePasswordDlgProc,
+ (LPARAM)NULL);
+ break;
+
+ case IDM_USER_RENAME:
+ {
+ INT nItem;
+ HWND hwndLV;
+
+ hwndLV = GetDlgItem(hwndDlg, IDC_USERS_LIST);
+ nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
+ if (nItem != -1)
+ {
+ (void)ListView_EditLabel(hwndLV, nItem);
+ }
+ }
+ break;
+
case IDM_USER_PROPERTIES:
MessageBeep(-1);
break;
@@ -187,8 +316,7 @@
break;
case WM_NOTIFY:
- OnNotify(hwndDlg, pUserData, (NMHDR *)lParam);
- break;
+ return OnNotify(hwndDlg, pUserData, (NMHDR *)lParam);
case WM_DESTROY:
DestroyMenu(pUserData->hPopupMenu);
Modified: trunk/reactos/dll/cpl/usrmgr/usrmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/usrmgr.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/usrmgr.c (original)
+++ trunk/reactos/dll/cpl/usrmgr/usrmgr.c Sun Dec 2 17:35:59 2007
@@ -20,7 +20,7 @@
APPLET Applets[NUM_APPLETS] =
{
{
- IDC_USRMGR_ICON,
+ IDI_USRMGR_ICON,
IDS_CPLNAME,
IDS_CPLDESCRIPTION,
UsrmgrApplet
@@ -60,7 +60,7 @@
psh.dwFlags = PSH_PROPSHEETPAGE;
psh.hwndParent = NULL;
psh.hInstance = hApplet;
- psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_USRMGR_ICON));
+ psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_USRMGR_ICON));
psh.pszCaption = Caption;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
Modified: trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/usrmgr.rbui…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild (original)
+++ trunk/reactos/dll/cpl/usrmgr/usrmgr.rbuild Sun Dec 2 17:35:59 2007
@@ -5,6 +5,7 @@
<include base="usrmgr">.</include>
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
+ <define name="WINVER">0x609</define>
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>
Modified: trunk/reactos/dll/cpl/usrmgr/usrmgr.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/usrmgr/usrmgr.rc?r…
==============================================================================
--- trunk/reactos/dll/cpl/usrmgr/usrmgr.rc (original)
+++ trunk/reactos/dll/cpl/usrmgr/usrmgr.rc Sun Dec 2 17:35:59 2007
@@ -11,7 +11,11 @@
123 24 DISCARDABLE "manifest.xml"
-IDC_USRMGR_ICON ICON "resources/applet.ico"
-IDC_USRMGR_ICON2 ICON "resources/applet.ico"
+IDI_USRMGR_ICON ICON "resources/applet.ico"
+IDI_USRMGR_ICON2 ICON "resources/applet.ico"
+
+IDI_USER ICON "resources/user.ico"
+IDI_LOCKED_USER ICON "resources/locked.ico"
+IDI_GROUP ICON "resources/group.ico"
#include "rsrc.rc"