Author: janderwald
Date: Fri Oct 12 18:25:58 2007
New Revision: 29537
URL:
http://svn.reactos.org/svn/reactos?rev=29537&view=rev
Log:
- explictely use PROPSHEETHEADERW
- implement _ILIsBitBucket function
- implement a IContextMenu for recycle bin interface but is currently unused see notes
shv_item_cmenu.c
- implement recycle property dialog resources in vista style
Modified:
trunk/reactos/dll/win32/shell32/drive.c
trunk/reactos/dll/win32/shell32/fprop.c
trunk/reactos/dll/win32/shell32/pidl.c
trunk/reactos/dll/win32/shell32/pidl.h
trunk/reactos/dll/win32/shell32/recyclebin.c
trunk/reactos/dll/win32/shell32/shell32_De.rc
trunk/reactos/dll/win32/shell32/shell32_En.rc
trunk/reactos/dll/win32/shell32/shell32_main.h
trunk/reactos/dll/win32/shell32/shres.rc
trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
Modified: trunk/reactos/dll/win32/shell32/drive.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/drive.c?…
==============================================================================
--- trunk/reactos/dll/win32/shell32/drive.c (original)
+++ trunk/reactos/dll/win32/shell32/drive.c Fri Oct 12 18:25:58 2007
@@ -411,8 +411,8 @@
BOOL ret;
UINT i;
- ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
- psh.dwSize = sizeof(PROPSHEETHEADER);
+ ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
+ psh.dwSize = sizeof(PROPSHEETHEADERW);
//psh.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE;
psh.hwndParent = NULL;
psh.nStartPage = 0;
Modified: trunk/reactos/dll/win32/shell32/fprop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/fprop.c?…
==============================================================================
--- trunk/reactos/dll/win32/shell32/fprop.c (original)
+++ trunk/reactos/dll/win32/shell32/fprop.c Fri Oct 12 18:25:58 2007
@@ -62,7 +62,7 @@
*
*/
HPROPSHEETPAGE
-SH_CreatePropertySheetPage(LPSTR resname, DLGPROC dlgproc, LPARAM lParam)
+SH_CreatePropertySheetPage(LPSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR
szTitle)
{
HRSRC hRes;
LPVOID lpsztemplate;
@@ -88,6 +88,11 @@
ppage.u.pResource = lpsztemplate;
ppage.pfnDlgProc = dlgproc;
ppage.lParam = lParam;
+ ppage.pszTitle = szTitle;
+ if (szTitle)
+ {
+ ppage.dwFlags |= PSP_USETITLE;
+ }
return CreatePropertySheetPageW(&ppage);
}
@@ -645,7 +650,7 @@
FIXME("directory / drive resources are missing\n");
return FALSE;
}
- hpage = SH_CreatePropertySheetPage("SHELL_FILE_GENERAL_DLG",
SH_FileGeneralDlgProc, (LPARAM)wFileName);
+ hpage = SH_CreatePropertySheetPage("SHELL_FILE_GENERAL_DLG",
SH_FileGeneralDlgProc, (LPARAM)wFileName, NULL);
if (hpage == NULL)
return FALSE;
@@ -654,7 +659,7 @@
num_pages++;
if ( GetFileVersionInfoSizeW(lpf, &dwHandle) )
{
- if ( (hpage =
SH_CreatePropertySheetPage("SHELL_FILE_VERSION_DLG",SH_FileVersionDlgProc,
(LPARAM)lpf))!= NULL)
+ if ( (hpage =
SH_CreatePropertySheetPage("SHELL_FILE_VERSION_DLG",SH_FileVersionDlgProc,
(LPARAM)lpf, NULL))!= NULL)
{
hppages[num_pages] = hpage;
num_pages++;
Modified: trunk/reactos/dll/win32/shell32/pidl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.c?r…
==============================================================================
--- trunk/reactos/dll/win32/shell32/pidl.c (original)
+++ trunk/reactos/dll/win32/shell32/pidl.c Fri Oct 12 18:25:58 2007
@@ -1633,6 +1633,16 @@
return IsEqualIID(iid, &CLSID_MyComputer);
return FALSE;
}
+BOOL _ILIsBitBucket(LPCITEMIDLIST pidl)
+{
+ REFIID iid = _ILGetGUIDPointer(pidl);
+
+ TRACE("(%p)\n",pidl);
+
+ if (iid)
+ return IsEqualIID(iid, &CLSID_RecycleBin);
+ return FALSE;
+}
BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl)
{
Modified: trunk/reactos/dll/win32/shell32/pidl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.h?r…
==============================================================================
--- trunk/reactos/dll/win32/shell32/pidl.h (original)
+++ trunk/reactos/dll/win32/shell32/pidl.h Fri Oct 12 18:25:58 2007
@@ -204,6 +204,7 @@
BOOL _ILIsUnicode (LPCITEMIDLIST pidl);
BOOL _ILIsDesktop (LPCITEMIDLIST pidl);
BOOL _ILIsMyComputer (LPCITEMIDLIST pidl);
+BOOL _ILIsBitBucket (LPCITEMIDLIST pidl);
BOOL _ILIsDrive (LPCITEMIDLIST pidl);
BOOL _ILIsFolder (LPCITEMIDLIST pidl);
BOOL _ILIsValue (LPCITEMIDLIST pidl);
Modified: trunk/reactos/dll/win32/shell32/recyclebin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/recycleb…
==============================================================================
--- trunk/reactos/dll/win32/shell32/recyclebin.c (original)
+++ trunk/reactos/dll/win32/shell32/recyclebin.c Fri Oct 12 18:25:58 2007
@@ -22,6 +22,8 @@
#define YDEBUG
#define COBJMACROS
#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#define MAX_PROPERTY_SHEET_PAGE 32
#include <stdarg.h>
@@ -40,6 +42,7 @@
#include "enumidlist.h"
#include "xdg.h"
#include "recyclebin.h"
+#include <prsht.h>
WINE_DEFAULT_DEBUG_CHANNEL(recyclebin);
@@ -102,13 +105,24 @@
{
const IShellFolder2Vtbl *lpVtbl;
const IPersistFolder2Vtbl *lpPersistFolderVtbl;
+ const IContextMenuVtbl *lpCmt;
LONG refCount;
+
+ INT iIdOpen;
+ INT iIdEmpty;
+ INT iIdProperties;
LPITEMIDLIST pidl;
} RecycleBin;
+static const IContextMenuVtbl recycleBincmVtbl;
static const IShellFolder2Vtbl recycleBinVtbl;
static const IPersistFolder2Vtbl recycleBinPersistVtbl;
+
+static RecycleBin *impl_from_IContextMenu(IContextMenu *iface)
+{
+ return (RecycleBin *)((char *)iface - FIELD_OFFSET(RecycleBin, lpCmt));
+}
static RecycleBin *impl_from_IPersistFolder(IPersistFolder2 *iface)
{
@@ -130,6 +144,7 @@
ZeroMemory(obj, sizeof(RecycleBin));
obj->lpVtbl = &recycleBinVtbl;
obj->lpPersistFolderVtbl = &recycleBinPersistVtbl;
+ obj->lpCmt = &recycleBincmVtbl;
if (FAILED(ret = IUnknown_QueryInterface((IUnknown *)obj, riid, ppOutput)))
{
RecycleBin_Destructor(obj);
@@ -159,6 +174,9 @@
if (IsEqualGUID(riid, &IID_IPersist) || IsEqualGUID(riid,
&IID_IPersistFolder)
|| IsEqualGUID(riid, &IID_IPersistFolder2))
*ppvObject = &This->lpPersistFolderVtbl;
+
+ if (IsEqualGUID(riid, &IID_IContextMenu))
+ *ppvObject = &This->lpCmt;
if (*ppvObject != NULL)
{
@@ -246,7 +264,7 @@
}
PDELETED_FILE_DETAILS_W
-UnpackDetailsFromPidl(LPITEMIDLIST pidl)
+UnpackDetailsFromPidl(LPCITEMIDLIST pidl)
{
return (PDELETED_FILE_DETAILS_W)&pidl->mkid.abID[1];
}
@@ -568,3 +586,201 @@
FIXME("stub\n");
return S_OK;
}
+static HRESULT WINAPI
+RecycleBin_IContextMenu_QueryInterface( IContextMenu* iface, REFIID riid, void**
ppvObject )
+{
+ return RecycleBin_QueryInterface((IShellFolder2 *)impl_from_IContextMenu(iface),
riid, ppvObject);
+}
+
+static ULONG WINAPI
+RecycleBin_IContextMenu_AddRef( IContextMenu* iface )
+{
+ return RecycleBin_AddRef((IShellFolder2 *)impl_from_IContextMenu(iface));
+}
+
+static ULONG WINAPI
+RecycleBin_IContextMenu_Release( IContextMenu* iface )
+{
+ return RecycleBin_Release((IShellFolder2 *)impl_from_IContextMenu(iface));
+}
+
+static HRESULT WINAPI
+RecycleBin_IContextMenu_QueryContextMenu( IContextMenu* iface, HMENU hmenu, UINT
indexMenu,
+ UINT idCmdFirst, UINT idCmdLast, UINT uFlags )
+{
+ RecycleBin * This = impl_from_IContextMenu(iface);
+ static WCHAR szOpen[] = { 'O','p','e','n',0 };
+ static WCHAR szEmpty[] = {
'E','m','p','t','y','
','R','e','c','y','c','l','e','
','B','i','n',0 };
+ static WCHAR szProperties[] = {
'P','r','o','p','e','r','t','i','e','s',0
};
+ MENUITEMINFOW mii;
+ int id = 1;
+
+ TRACE("%p %p %u %u %u %u\n", This,
+ hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags );
+
+ if ( !hmenu )
+ return E_INVALIDARG;
+
+ memset( &mii, 0, sizeof(mii) );
+ mii.cbSize = sizeof (mii);
+ mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
+ mii.dwTypeData = (LPWSTR)szOpen;
+ mii.cch = strlenW( mii.dwTypeData );
+ mii.wID = idCmdFirst + id++;
+ mii.fState = MFS_ENABLED;
+ mii.fType = MFT_STRING;
+ if (!InsertMenuItemW( hmenu, indexMenu, TRUE, &mii ))
+ return E_FAIL;
+ This->iIdOpen = 0;
+
+ mii.fState = MFS_ENABLED;
+ mii.dwTypeData = (LPWSTR)szEmpty;
+ mii.cch = strlenW( mii.dwTypeData );
+ mii.wID = idCmdFirst + id++;
+ if (!InsertMenuItemW( hmenu, idCmdLast, TRUE, &mii ))
+ {
+ TRACE("RecycleBin_IContextMenu_QueryContextMenu failed to insert item
properties");
+ return E_FAIL;
+ }
+ This->iIdEmpty = 1;
+ id++;
+
+ mii.fState = MFS_ENABLED;
+ mii.dwTypeData = (LPWSTR)szProperties;
+ mii.cch = strlenW( mii.dwTypeData );
+ mii.wID = idCmdFirst + id++;
+ if (!InsertMenuItemW( hmenu, idCmdLast, TRUE, &mii ))
+ {
+ TRACE("RecycleBin_IContextMenu_QueryContextMenu failed to insert item
properties");
+ return E_FAIL;
+ }
+ This->iIdProperties = 2;
+ id++;
+
+ return MAKE_HRESULT( SEVERITY_SUCCESS, 0, id );
+}
+
+static HRESULT WINAPI
+RecycleBin_IContextMenu_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici
)
+{
+ RecycleBin * This = impl_from_IContextMenu(iface);
+
+ TRACE("%p %p\n", This, lpici );
+
+ return E_FAIL;
+}
+
+static HRESULT WINAPI
+RecycleBin_IContextMenu_GetCommandString( IContextMenu* iface, UINT_PTR idCmd, UINT
uType,
+ UINT* pwReserved, LPSTR pszName, UINT cchMax )
+{
+ RecycleBin * This = impl_from_IContextMenu(iface);
+
+ FIXME("%p %lu %u %p %p %u\n", This,
+ idCmd, uType, pwReserved, pszName, cchMax );
+
+ return E_NOTIMPL;
+}
+
+static const IContextMenuVtbl recycleBincmVtbl =
+{
+ RecycleBin_IContextMenu_QueryInterface,
+ RecycleBin_IContextMenu_AddRef,
+ RecycleBin_IContextMenu_Release,
+ RecycleBin_IContextMenu_QueryContextMenu,
+ RecycleBin_IContextMenu_InvokeCommand,
+ RecycleBin_IContextMenu_GetCommandString
+};
+
+INT_PTR
+CALLBACK
+RecycleBinGeneralDlg(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+)
+{
+
+
+ return FALSE;
+}
+
+void
+InitializeBitBucketDlg(HWND hwndDlg)
+{
+ WCHAR CurDrive = L'A';
+ WCHAR szDrive[] = L"A:\\";
+ DWORD dwDrives;
+ WCHAR szName[MAX_PATH+1];
+ DWORD MaxComponent, Flags;
+
+ dwDrives = GetLogicalDrives();
+ do
+ {
+ if ((dwDrives & 0x1))
+ {
+ UINT Type = GetDriveTypeW(szDrive);
+ if (Type == DRIVE_FIXED) //FIXME
+ {
+ if (!GetVolumeInformationW(szDrive, szName, MAX_PATH+1, NULL,
&MaxComponent, &Flags, NULL, 0))
+ {
+ wcscpy(szName, szDrive);
+ }
+ }
+ }
+ CurDrive++;
+ szDrive[0] = CurDrive;
+ dwDrives = (dwDrives >> 1);
+ }while(dwDrives);
+
+
+}
+
+
+
+INT_PTR
+CALLBACK
+BitBucketDlg(
+ HWND hwndDlg,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam
+)
+{
+
+
+ return FALSE;
+}
+
+BOOL SH_ShowRecycleBinProperties(WCHAR sDrive)
+{
+ HPROPSHEETPAGE hpsp[1];
+ PROPSHEETHEADERW psh;
+ HPROPSHEETPAGE hprop;
+
+ BOOL ret;
+
+
+ ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
+ psh.dwSize = sizeof(PROPSHEETHEADERW);
+ psh.hwndParent = NULL;
+ psh.u3.phpage = hpsp;
+
+ hprop = SH_CreatePropertySheetPage("BITBUCKET_PROPERTIES_DLG", BitBucketDlg,
(LPARAM)0, NULL);
+ if (!hprop)
+ {
+ ERR("Failed to create property sheet");
+ return FALSE;
+ }
+ hpsp[psh.nPages] = hprop;
+ psh.nPages++;
+
+
+ ret = PropertySheetW(&psh);
+ if (ret < 0)
+ return FALSE;
+ else
+ return TRUE;
+}
+
Modified: trunk/reactos/dll/win32/shell32/shell32_De.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32_…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shell32_De.rc (original)
+++ trunk/reactos/dll/win32/shell32/shell32_De.rc Fri Oct 12 18:25:58 2007
@@ -327,6 +327,19 @@
PUSHBUTTON "Abbrechen", 14008, 140, 170, 60, 15, WS_TABSTOP
}
+BITBUCKET_PROPERTIES_DLG DIALOGEX 0, 0, 240, 190
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Recycle Bin Properties"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+{
+ CONTROL "", -1, "SysListView32", LVS_REPORT | LVS_SHAREIMAGELISTS |
WS_BORDER | WS_TABSTOP, 10, 10, 220, 50
+ GROUPBOX "Settings for selected location", -1, 10, 80, 220, 70
+ RADIOBUTTON "&Custom size:", -1, 20, 90, 80, 10
+ EDITTEXT -1, 90, 90, 50, 10, WS_TABSTOP
+ LTEXT "M&aximum size(MB):", -1, 20, 100, 70, 10
+ RADIOBUTTON "Do not move files to the &Recycle Bin. Remove files immediately
when deleted.", -1, 20, 115, 170, 20, BS_MULTILINE | WS_TABSTOP
+ RADIOBUTTON"&Display delete confirmation dialog", -1, 20, 155, 140, 10,
WS_TABSTOP
+}
STRINGTABLE DISCARDABLE
{
Modified: trunk/reactos/dll/win32/shell32/shell32_En.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32_…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shell32_En.rc (original)
+++ trunk/reactos/dll/win32/shell32/shell32_En.rc Fri Oct 12 18:25:58 2007
@@ -327,6 +327,19 @@
PUSHBUTTON "Cancel", 14008, 140, 170, 60, 15, WS_TABSTOP
}
+BITBUCKET_PROPERTIES_DLG DIALOGEX 0, 0, 240, 190
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "Recycle Bin Properties"
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+{
+ CONTROL "", -1, "SysListView32", LVS_REPORT | LVS_SHAREIMAGELISTS |
WS_BORDER | WS_TABSTOP, 10, 10, 220, 50
+ GROUPBOX "Settings for selected location", -1, 10, 80, 220, 70
+ RADIOBUTTON "&Custom size:", -1, 20, 90, 80, 10
+ EDITTEXT -1, 90, 90, 50, 10, WS_TABSTOP
+ LTEXT "M&aximum size(MB):", -1, 20, 100, 70, 10
+ RADIOBUTTON "Do not move files to the &Recycle Bin. Remove files immediately
when deleted.", -1, 20, 115, 170, 20, BS_MULTILINE | WS_TABSTOP
+ RADIOBUTTON"&Display delete confirmation dialog", -1, 20, 155, 140, 10,
WS_TABSTOP
+}
STRINGTABLE DISCARDABLE
{
Modified: trunk/reactos/dll/win32/shell32/shell32_main.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32_…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shell32_main.h (original)
+++ trunk/reactos/dll/win32/shell32/shell32_main.h Fri Oct 12 18:25:58 2007
@@ -241,6 +241,7 @@
INT_PTR CALLBACK SH_FileGeneralDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
lParam);
INT_PTR CALLBACK SH_FileVersionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
lParam);
-HPROPSHEETPAGE SH_CreatePropertySheetPage(LPSTR resname, DLGPROC dlgproc, LPARAM
lParam);
+HPROPSHEETPAGE SH_CreatePropertySheetPage(LPSTR resname, DLGPROC dlgproc, LPARAM lParam,
LPWSTR szTitle);
BOOL SH_ShowDriveProperties(WCHAR * drive);
+BOOL SH_ShowRecycleBinProperties(WCHAR sDrive);
#endif
Modified: trunk/reactos/dll/win32/shell32/shres.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shres.rc…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shres.rc (original)
+++ trunk/reactos/dll/win32/shell32/shres.rc Fri Oct 12 18:25:58 2007
@@ -34,7 +34,6 @@
BEGIN
VK_F5, FCIDM_SHVIEW_REFRESH, VIRTKEY
END
-
/*
Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_item…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shv_item_cmenu.c (original)
+++ trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Fri Oct 12 18:25:58 2007
@@ -396,6 +396,13 @@
LPITEMIDLIST pidlFQ = NULL;
SHELLEXECUTEINFOA sei;
+ /*
+ * FIXXME
+ *
+ * The IShellFolder interface GetUIObject should create the specific item and then
query if it has an IContextMenu interface
+ * If yes return interface to it.
+ */
+
if (_ILIsMyComputer(This->apidl[0]))
{
ShellExecuteA(hwnd, "open", "rundll32.exe
shell32.dll,Control_RunDLL sysdm.cpl", NULL, NULL, SW_SHOWNORMAL);
@@ -412,6 +419,12 @@
ILGetDisplayName(This->apidl[0], buffer);
SH_ShowDriveProperties(buffer);
return;
+ }
+ else if (_ILIsBitBucket(This->apidl[0]))
+ {
+ ///FIXME
+ WCHAR szDrive = 'C';
+ SH_ShowRecycleBinProperties(szDrive);
}
else
{