Author: janderwald
Date: Thu Jul 24 16:26:36 2008
New Revision: 34757
URL:
http://svn.reactos.org/svn/reactos?rev=34757&view=rev
Log:
- enumerate all file types for folder options namespace applet
- use mui string when available
- load the title from shell32 module base
- remove PSH_PROPTITLE flag
Modified:
trunk/reactos/dll/win32/shell32/folder_options.c
Modified: trunk/reactos/dll/win32/shell32/folder_options.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folder_o…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folder_options.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folder_options.c [iso-8859-1] Thu Jul 24 16:26:36
2008
@@ -80,6 +80,105 @@
return FALSE;
}
+VOID
+InitializeFileTypesListCtrlColumns(HWND hDlgCtrl)
+{
+ RECT clientRect;
+ LVCOLUMNW col;
+ WCHAR szName[50];
+
+ if (!LoadStringW(shell32_hInstance, IDS_COLUMN_EXTENSION, szName, sizeof(szName) /
sizeof(WCHAR)))
+ szName[0] = 0;
+ szName[(sizeof(szName)/sizeof(WCHAR))-1] = 0;
+
+ GetClientRect(hDlgCtrl, &clientRect);
+ ZeroMemory(&col, sizeof(LV_COLUMN));
+ col.mask = LVCF_SUBITEM | LVCF_WIDTH | LVCF_FMT;
+ col.iSubItem = 0;
+ col.pszText = szName;
+ col.fmt = LVCFMT_LEFT;
+ col.cx = (clientRect.right - clientRect.left) -
GetSystemMetrics(SM_CXVSCROLL);
+ (void)ListView_InsertColumnW(hDlgCtrl, 0, &col);
+}
+INT
+FindItem(HWND hDlgCtrl, WCHAR * ItemName)
+{
+ LVFINDINFOW findInfo;
+ ZeroMemory(&findInfo, sizeof(LVFINDINFOW));
+
+ findInfo.flags = LVFI_STRING;
+ findInfo.psz = ItemName;
+ return ListView_FindItem(hDlgCtrl, 0, &findInfo);
+}
+
+VOID
+InsertFileType(HWND hDlgCtrl, WCHAR * szName, DWORD Size, INT iItem)
+{
+ WCHAR szPath[100];
+ HKEY hKey;
+ LVITEMW lvItem;
+ DWORD dwSize;
+
+ if (FindItem(hDlgCtrl, szName) != -1)
+ return;
+
+ wcscpy(szPath, szName);
+ /* get the name */
+ if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szPath, 0, KEY_READ, &hKey) ==
ERROR_SUCCESS)
+ {
+ if (RegLoadMUIStringW(hKey, L"FriendlyTypeName", szName, Size, NULL, 0,
NULL) != ERROR_SUCCESS)
+ {
+ dwSize = Size;
+ if (RegQueryValueExW(hKey, NULL, NULL, NULL, (LPBYTE)szName, &dwSize) !=
ERROR_SUCCESS)
+ {
+ wcscpy(szName, szPath);
+ }
+ }
+ RegCloseKey(hKey);
+ szName[(Size/sizeof(WCHAR))-1] = 0;
+ }
+ wcscat(szPath, L"\\shell");
+
+ ZeroMemory(&lvItem, sizeof(LVITEMW));
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
+ lvItem.state = LVIS_SELECTED;
+ lvItem.pszText = szName;
+ lvItem.iItem = iItem;
+
+ if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szPath, 0, KEY_READ, &hKey) ==
ERROR_SUCCESS)
+ {
+ lvItem.lParam = 0;
+ (void)ListView_InsertItemW(hDlgCtrl, &lvItem);
+ RegCloseKey(hKey);
+ }
+}
+
+BOOL
+InitializeFileTypesListCtrl(HWND hwndDlg)
+{
+ HWND hDlgCtrl;
+ DWORD dwIndex = 0;
+ WCHAR szName[50];
+ DWORD dwName;
+ INT iItem = 0;
+
+
+ hDlgCtrl = GetDlgItem(hwndDlg, 14000);
+ InitializeFileTypesListCtrlColumns(hDlgCtrl);
+
+
+
+ dwName = sizeof(szName) / sizeof(WCHAR);
+
+ while(RegEnumKeyExW(HKEY_CLASSES_ROOT, dwIndex++, szName, &dwName, NULL, NULL,
NULL, NULL) == ERROR_SUCCESS)
+ {
+ InsertFileType(hDlgCtrl, szName, sizeof(szName), iItem++);
+ dwName = sizeof(szName) / sizeof(WCHAR);
+ }
+ return TRUE;
+}
+
+
INT_PTR
CALLBACK
FolderOptionsFileTypesDlg(
@@ -89,7 +188,12 @@
LPARAM lParam
)
{
-
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ InitializeFileTypesListCtrl(hwndDlg);
+ return TRUE;
+ }
return FALSE;
@@ -102,7 +206,7 @@
PROPSHEETHEADERW pinfo;
HPROPSHEETPAGE hppages[3];
HPROPSHEETPAGE hpage;
- UINT num_pages = 0;
+ UINT num_pages = 0;
WCHAR szOptions[100];
hpage = SH_CreatePropertySheetPage("FOLDER_OPTIONS_GENERAL_DLG",
FolderOptionsGeneralDlg, 0, NULL);
@@ -116,14 +220,14 @@
hpage = SH_CreatePropertySheetPage("FOLDER_OPTIONS_FILETYPES_DLG",
FolderOptionsFileTypesDlg, 0, NULL);
if (hpage)
hppages[num_pages++] = hpage;
-
+
szOptions[0] = L'\0';
- LoadStringW(hInst, IDS_FOLDER_OPTIONS, szOptions, sizeof(szOptions) /
sizeof(WCHAR));
- szOptions[99] = L'\0';
-
+ LoadStringW(shell32_hInstance, IDS_FOLDER_OPTIONS, szOptions, sizeof(szOptions) /
sizeof(WCHAR));
+ szOptions[(sizeof(szOptions)/sizeof(WCHAR))-1] = L'\0';
+
memset(&pinfo, 0x0, sizeof(PROPSHEETHEADERW));
pinfo.dwSize = sizeof(PROPSHEETHEADERW);
- pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE;
+ pinfo.dwFlags = PSH_NOCONTEXTHELP;
pinfo.nPages = num_pages;
pinfo.u3.phpage = hppages;
pinfo.pszCaption = szOptions;