Skip to content

Commit 52f27ff

Browse files
authored
Fix: Fixed COMException in SidebarItem.ItemBorder_Drop (#16267)
1 parent 24e96cc commit 52f27ff

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

src/Files.App/UserControls/Sidebar/SidebarItem.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,7 @@ private async void ItemBorder_Drop(object sender, DragEventArgs e)
433433
{
434434
UpdatePointerState();
435435
if (Owner is not null)
436-
{
437-
var deferral = e.GetDeferral();
438436
await Owner.RaiseItemDropped(this, DetermineDropTargetPosition(e), e);
439-
deferral.Complete();
440-
}
441437
}
442438

443439
private SidebarItemDropPosition DetermineDropTargetPosition(DragEventArgs args)

src/Files.App/ViewModels/UserControls/SidebarViewModel.cs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,18 +1243,20 @@ private async Task HandleTagItemDragOverAsync(FileTagItem tagItem, ItemDragOverE
12431243

12441244
args.RawEvent.Handled = true;
12451245

1246-
var storageItems = await Utils.Storage.FilesystemHelpers.GetDraggedStorageItems(args.DroppedItem);
1247-
1248-
if (!storageItems.Any())
1249-
{
1250-
args.RawEvent.AcceptedOperation = DataPackageOperation.None;
1251-
}
1252-
else
1253-
{
1254-
args.RawEvent.DragUIOverride.IsCaptionVisible = true;
1255-
args.RawEvent.DragUIOverride.Caption = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), tagItem.Text);
1256-
args.RawEvent.AcceptedOperation = DataPackageOperation.Link;
1257-
}
1246+
// Comment out the code for dropping to Tags section as it is currently not supported.
1247+
1248+
//var storageItems = await Utils.Storage.FilesystemHelpers.GetDraggedStorageItems(args.DroppedItem);
1249+
1250+
//if (!storageItems.Any())
1251+
//{
1252+
args.RawEvent.AcceptedOperation = DataPackageOperation.None;
1253+
//}
1254+
//else
1255+
//{
1256+
// args.RawEvent.DragUIOverride.IsCaptionVisible = true;
1257+
// args.RawEvent.DragUIOverride.Caption = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), tagItem.Text);
1258+
// args.RawEvent.AcceptedOperation = DataPackageOperation.Link;
1259+
//}
12581260
}
12591261

12601262

@@ -1264,8 +1266,11 @@ public async Task HandleItemDroppedAsync(ItemDroppedEventArgs args)
12641266
await HandleLocationItemDroppedAsync(locationItem, args);
12651267
else if (args.DropTarget is DriveItem driveItem)
12661268
await HandleDriveItemDroppedAsync(driveItem, args);
1267-
else if (args.DropTarget is FileTagItem fileTagItem)
1268-
await HandleTagItemDroppedAsync(fileTagItem, args);
1269+
1270+
// Comment out the code for dropping to Tags section as it is currently not supported.
1271+
1272+
//else if (args.DropTarget is FileTagItem fileTagItem)
1273+
// await HandleTagItemDroppedAsync(fileTagItem, args);
12691274
}
12701275

12711276
private async Task HandleLocationItemDroppedAsync(LocationItem locationItem, ItemDroppedEventArgs args)
@@ -1293,6 +1298,7 @@ private Task<ReturnResult> HandleDriveItemDroppedAsync(DriveItem driveItem, Item
12931298
return FilesystemHelpers.PerformOperationTypeAsync(args.RawEvent.AcceptedOperation, args.RawEvent.DataView, driveItem.Path, false, true);
12941299
}
12951300

1301+
// TODO: This method effectively does nothing. We need to implement the functionality for dropping to Tags section.
12961302
private async Task HandleTagItemDroppedAsync(FileTagItem fileTagItem, ItemDroppedEventArgs args)
12971303
{
12981304
var storageItems = await Utils.Storage.FilesystemHelpers.GetDraggedStorageItems(args.DroppedItem);

0 commit comments

Comments
 (0)