mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
- 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 svn path=/trunk/; revision=29537
This commit is contained in:
parent
bb6da9c74e
commit
16fd2633a6
|
@ -411,8 +411,8 @@ SH_ShowDriveProperties(WCHAR * drive)
|
|||
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;
|
||||
|
|
|
@ -62,7 +62,7 @@ typedef struct _LANGANDCODEPAGE_
|
|||
*
|
||||
*/
|
||||
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 @@ SH_CreatePropertySheetPage(LPSTR resname, DLGPROC dlgproc, LPARAM lParam)
|
|||
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 @@ SH_ShowPropertiesDialog(WCHAR * lpf)
|
|||
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 @@ SH_ShowPropertiesDialog(WCHAR * lpf)
|
|||
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++;
|
||||
|
|
|
@ -1633,6 +1633,16 @@ BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -204,6 +204,7 @@ DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT);
|
|||
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);
|
||||
|
|
|
@ -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,14 +105,25 @@ typedef struct tagRecycleBin
|
|||
{
|
||||
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)
|
||||
{
|
||||
return (RecycleBin *)((char *)iface - FIELD_OFFSET(RecycleBin, lpPersistFolderVtbl));
|
||||
|
@ -130,6 +144,7 @@ HRESULT WINAPI RecycleBin_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *
|
|||
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);
|
||||
|
@ -160,6 +175,9 @@ static HRESULT WINAPI RecycleBin_QueryInterface(IShellFolder2 *iface, REFIID rii
|
|||
|| IsEqualGUID(riid, &IID_IPersistFolder2))
|
||||
*ppvObject = &This->lpPersistFolderVtbl;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IContextMenu))
|
||||
*ppvObject = &This->lpCmt;
|
||||
|
||||
if (*ppvObject != NULL)
|
||||
{
|
||||
IUnknown_AddRef((IUnknown *)*ppvObject);
|
||||
|
@ -246,7 +264,7 @@ CBEnumBitBucket(IN PVOID Context, IN HANDLE hDeletedFile)
|
|||
}
|
||||
|
||||
PDELETED_FILE_DETAILS_W
|
||||
UnpackDetailsFromPidl(LPITEMIDLIST pidl)
|
||||
UnpackDetailsFromPidl(LPCITEMIDLIST pidl)
|
||||
{
|
||||
return (PDELETED_FILE_DETAILS_W)&pidl->mkid.abID[1];
|
||||
}
|
||||
|
@ -568,3 +586,201 @@ HRESULT WINAPI SHUpdateRecycleBinIcon(void)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -327,6 +327,19 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
|||
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
|
||||
{
|
||||
|
|
|
@ -327,6 +327,19 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
|||
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
|
||||
{
|
||||
|
|
|
@ -241,6 +241,7 @@ BOOL SHELL_IsShortcut(LPCITEMIDLIST);
|
|||
|
||||
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
|
||||
|
|
|
@ -36,7 +36,6 @@ BEGIN
|
|||
END
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Everything that does not depend on language,
|
||||
* like textless bitmaps etc, go into the
|
||||
|
|
|
@ -396,6 +396,13 @@ static void DoProperties(
|
|||
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);
|
||||
|
@ -413,6 +420,12 @@ static void DoProperties(
|
|||
SH_ShowDriveProperties(buffer);
|
||||
return;
|
||||
}
|
||||
else if (_ILIsBitBucket(This->apidl[0]))
|
||||
{
|
||||
///FIXME
|
||||
WCHAR szDrive = 'C';
|
||||
SH_ShowRecycleBinProperties(szDrive);
|
||||
}
|
||||
else
|
||||
{
|
||||
pidlFQ = ILCombine(This->pidl, This->apidl[0]);
|
||||
|
|
Loading…
Reference in a new issue