Rebase against 934cfb86b5e2b485b4b90e1eeac4021733559591.

This commit is contained in:
Zebediah Figura 2024-03-07 22:02:49 -06:00
parent 445ab8ff01
commit 7d2ceeab63
4 changed files with 1 additions and 264 deletions

View File

@ -1,126 +0,0 @@
From 912755a07e996e6178a749f8b344c71a9401d6d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 04:17:19 +0200
Subject: [PATCH] shell32: Add parameter to ISFHelper::DeleteItems to allow
deleting files without confirmation.
---
dlls/shell32/brsfolder.c | 2 +-
dlls/shell32/recyclebin.c | 6 +++---
dlls/shell32/shellfolder.h | 4 ++--
dlls/shell32/shfldr_fs.c | 3 ++-
dlls/shell32/shlview.c | 2 +-
dlls/shell32/shlview_cmenu.c | 2 +-
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index 188524d6a99..d33d3f01009 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -657,7 +657,7 @@ static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydo
return 0;
/* perform the item deletion - tree view gets updated over shell notification */
- ISFHelper_DeleteItems(psfhlp, 1, &item_id);
+ ISFHelper_DeleteItems(psfhlp, 1, &item_id, TRUE);
ISFHelper_Release(psfhlp);
}
break;
diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c
index 807cae3d81d..60462f9358f 100644
--- a/dlls/shell32/recyclebin.c
+++ b/dlls/shell32/recyclebin.c
@@ -173,7 +173,7 @@ static void DoErase(RecycleBinMenu *This)
ISFHelper *helper;
IShellFolder2_QueryInterface(This->folder,&IID_ISFHelper,(void**)&helper);
if(helper)
- ISFHelper_DeleteItems(helper,This->cidl,(LPCITEMIDLIST*)This->apidl);
+ ISFHelper_DeleteItems(helper, This->cidl, (LPCITEMIDLIST *)This->apidl, TRUE);
}
static void DoRestore(RecycleBinMenu *This)
@@ -800,10 +800,10 @@ static HRESULT erase_items(HWND parent,const LPCITEMIDLIST * apidl, UINT cidl, B
}
static HRESULT WINAPI RecycleBin_DeleteItems(ISFHelper * iface, UINT cidl,
- LPCITEMIDLIST * apidl)
+ LPCITEMIDLIST * apidl, BOOL confirm)
{
TRACE("(%p,%u,%p)\n",iface,cidl,apidl);
- return erase_items(GetActiveWindow(),apidl,cidl,TRUE);
+ return erase_items(GetActiveWindow(), apidl, cidl, confirm);
}
static HRESULT WINAPI RecycleBin_CopyItems(ISFHelper * iface,
diff --git a/dlls/shell32/shellfolder.h b/dlls/shell32/shellfolder.h
index 942e0e7ea28..b8083a2625a 100644
--- a/dlls/shell32/shellfolder.h
+++ b/dlls/shell32/shellfolder.h
@@ -48,7 +48,7 @@ DECLARE_INTERFACE_(ISFHelper,IUnknown)
/*** ISFHelper methods ***/
STDMETHOD(GetUniqueName)(THIS_ LPWSTR lpName, UINT uLen) PURE;
STDMETHOD(AddFolder)(THIS_ HWND hwnd, LPCWSTR lpName, LPITEMIDLIST * ppidlOut) PURE;
- STDMETHOD(DeleteItems)(THIS_ UINT cidl, LPCITEMIDLIST * apidl) PURE;
+ STDMETHOD(DeleteItems)(THIS_ UINT cidl, LPCITEMIDLIST *apidl, BOOL confirm) PURE;
STDMETHOD(CopyItems)(THIS_ IShellFolder * pSFFrom, UINT cidl, LPCITEMIDLIST * apidl) PURE;
};
#undef INTERFACE
@@ -61,7 +61,7 @@ DECLARE_INTERFACE_(ISFHelper,IUnknown)
/*** ISFHelper methods ***/
#define ISFHelper_GetUniqueName(p,a,b) (p)->lpVtbl->GetUniqueName(p,a,b)
#define ISFHelper_AddFolder(p,a,b,c) (p)->lpVtbl->AddFolder(p,a,b,c)
-#define ISFHelper_DeleteItems(p,a,b) (p)->lpVtbl->DeleteItems(p,a,b)
+#define ISFHelper_DeleteItems(p,a,b,c) (p)->lpVtbl->DeleteItems(p,a,b,c)
#define ISFHelper_CopyItems(p,a,b,c) (p)->lpVtbl->CopyItems(p,a,b,c)
#endif
diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c
index 2fa17dee1dc..8d5e016596f 100644
--- a/dlls/shell32/shfldr_fs.c
+++ b/dlls/shell32/shfldr_fs.c
@@ -1285,7 +1285,7 @@ static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, const LPCITEMIDLIS
* deletes items in folder
*/
static HRESULT WINAPI
-ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
+ISFHelper_fnDeleteItems (ISFHelper *iface, UINT cidl, LPCITEMIDLIST *apidl, BOOL confirm)
{
IGenericSFImpl *This = impl_from_ISFHelper(iface);
UINT i;
@@ -1310,6 +1310,7 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
op.wFunc = FO_DELETE;
op.pFrom = wszPathsList;
op.fFlags = FOF_ALLOWUNDO;
+ if (!confirm) op.fFlags |= FOF_NOCONFIRMATION;
if (SHFileOperationW(&op))
{
WARN("SHFileOperation failed\n");
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index 63512deb4b2..59376fb905f 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -1573,7 +1573,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
}
/* perform the item deletion */
- ISFHelper_DeleteItems(psfhlp, i, (LPCITEMIDLIST*)pItems);
+ ISFHelper_DeleteItems(psfhlp, i, (LPCITEMIDLIST *)pItems, TRUE);
ISFHelper_Release(psfhlp);
/* free pidl array memory */
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 7ebdaff588b..8ea828942e0 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -447,7 +447,7 @@ static void DoDelete(ContextMenu *This)
IShellFolder_QueryInterface(This->parent, &IID_ISFHelper, (void**)&helper);
if (helper)
{
- ISFHelper_DeleteItems(helper, This->cidl, (LPCITEMIDLIST*)This->apidl);
+ ISFHelper_DeleteItems(helper, This->cidl, (LPCITEMIDLIST *)This->apidl, TRUE);
ISFHelper_Release(helper);
}
}
--
2.33.0

View File

@ -1,133 +0,0 @@
From 6743f6300dfd2903fc1739949826bd7b742348ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 04:22:07 +0200
Subject: [PATCH] shell32: Remove source files when using cut in the context
menu.
---
dlls/shell32/shlview_cmenu.c | 73 +++++++++++++++++++++++++++++++++---
1 file changed, 67 insertions(+), 6 deletions(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index abee4c93a35..6a16aab2f25 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -333,6 +333,64 @@ static void DoDelete(ContextMenu *This)
}
}
+/**************************************************************************
+ * SetDropEffect
+ *
+ * Set the drop effect in a IDataObject object
+ */
+static void SetDropEffect(IDataObject *dataobject, DWORD value)
+{
+ FORMATETC formatetc;
+ STGMEDIUM medium;
+ DWORD *effect;
+
+ InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECTW), TYMED_HGLOBAL);
+
+ medium.tymed = TYMED_HGLOBAL;
+ medium.pUnkForRelease = NULL;
+ medium.hGlobal = GlobalAlloc(GHND|GMEM_SHARE, sizeof(DWORD));
+ if (!medium.hGlobal) return;
+
+ effect = GlobalLock(medium.hGlobal);
+ if (!effect)
+ {
+ ReleaseStgMedium(&medium);
+ return;
+ }
+ *effect = value;
+ GlobalUnlock(effect);
+
+ IDataObject_SetData(dataobject, &formatetc, &medium, FALSE);
+ ReleaseStgMedium(&medium);
+}
+
+/**************************************************************************
+ * GetDropEffect
+ *
+ * Get the drop effect from a IDataObject object
+ */
+static void GetDropEffect(IDataObject *dataobject, DWORD *value)
+{
+ FORMATETC formatetc;
+ STGMEDIUM medium;
+ DWORD *effect;
+
+ *value = DROPEFFECT_NONE;
+
+ InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECTW), TYMED_HGLOBAL);
+
+ if (SUCCEEDED(IDataObject_GetData(dataobject, &formatetc, &medium)))
+ {
+ effect = GlobalLock(medium.hGlobal);
+ if (effect)
+ {
+ *value = *effect;
+ GlobalUnlock(effect);
+ }
+ ReleaseStgMedium(&medium);
+ }
+}
+
/**************************************************************************
* DoCopyOrCut
*
@@ -346,6 +404,7 @@ static void DoCopyOrCut(ContextMenu *This, HWND hwnd, BOOL cut)
if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->parent, hwnd, This->cidl, (LPCITEMIDLIST*)This->apidl, &IID_IDataObject, 0, (void**)&dataobject)))
{
+ SetDropEffect(dataobject, cut ? DROPEFFECT_MOVE : DROPEFFECT_COPY);
OleSetClipboard(dataobject);
IDataObject_Release(dataobject);
}
@@ -1170,7 +1229,7 @@ static void DoNewFolder(ContextMenu *This, IShellView *view)
}
}
-static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
+static HRESULT paste_pidls(ContextMenu *This, IDataObject *pda, ITEMIDLIST **pidls, UINT count)
{
IShellFolder *psfDesktop;
UINT i;
@@ -1202,10 +1261,12 @@ static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
/* do the copy/move */
if (psfhlpdst && psfhlpsrc)
{
+ DWORD dropEffect;
+ GetDropEffect(pda, &dropEffect);
+
hr = ISFHelper_CopyItems(psfhlpdst, psfFrom, 1, (LPCITEMIDLIST*)&pidl_item);
- /* FIXME handle move
- ISFHelper_DeleteItems(psfhlpsrc, 1, &pidl_item);
- */
+ if (SUCCEEDED(hr) && dropEffect == DROPEFFECT_MOVE)
+ hr = ISFHelper_DeleteItems(psfhlpsrc, 1, (LPCITEMIDLIST*)&pidl_item, FALSE);
}
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
@@ -1251,7 +1312,7 @@ static HRESULT DoPaste(ContextMenu *This)
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
if (apidl)
{
- hr = paste_pidls(This, apidl, lpcida->cidl);
+ hr = paste_pidls(This, pda, apidl, lpcida->cidl);
_ILFreeaPidl(apidl, lpcida->cidl);
SHFree(pidl);
}
@@ -1289,7 +1350,7 @@ static HRESULT DoPaste(ContextMenu *This)
}
}
if (SUCCEEDED(hr))
- hr = paste_pidls(This, pidls, count);
+ hr = paste_pidls(This, pda, pidls, count);
_ILFreeaPidl(pidls, count);
}
else
--
2.30.2

View File

@ -1,4 +0,0 @@
Fixes: [34319] Add support for Paste in context menu
Fixes: [34322] Fix implementation of Cut file operation
Fixes: [34321] Fix Cut/Copy/Paste keyboard shortcuts in Total Commander
Disabled: true

View File

@ -1 +1 @@
83476e3d4ab0a0c7b1eca392e363591ba550440c
934cfb86b5e2b485b4b90e1eeac4021733559591