Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Files.App/UserControls/Sidebar/SidebarItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,7 @@ private async void ItemBorder_Drop(object sender, DragEventArgs e)
{
UpdatePointerState();
if (Owner is not null)
{
var deferral = e.GetDeferral();
await Owner.RaiseItemDropped(this, DetermineDropTargetPosition(e), e);
deferral.Complete();
}
}

private SidebarItemDropPosition DetermineDropTargetPosition(DragEventArgs args)
Expand Down
34 changes: 20 additions & 14 deletions src/Files.App/ViewModels/UserControls/SidebarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1243,18 +1243,20 @@ private async Task HandleTagItemDragOverAsync(FileTagItem tagItem, ItemDragOverE

args.RawEvent.Handled = true;

var storageItems = await Utils.Storage.FilesystemHelpers.GetDraggedStorageItems(args.DroppedItem);

if (!storageItems.Any())
{
args.RawEvent.AcceptedOperation = DataPackageOperation.None;
}
else
{
args.RawEvent.DragUIOverride.IsCaptionVisible = true;
args.RawEvent.DragUIOverride.Caption = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), tagItem.Text);
args.RawEvent.AcceptedOperation = DataPackageOperation.Link;
}
// Comment out the code for dropping to Tags section as it is currently not supported.

//var storageItems = await Utils.Storage.FilesystemHelpers.GetDraggedStorageItems(args.DroppedItem);

//if (!storageItems.Any())
//{
args.RawEvent.AcceptedOperation = DataPackageOperation.None;
//}
//else
//{
// args.RawEvent.DragUIOverride.IsCaptionVisible = true;
// args.RawEvent.DragUIOverride.Caption = string.Format("LinkToFolderCaptionText".GetLocalizedResource(), tagItem.Text);
// args.RawEvent.AcceptedOperation = DataPackageOperation.Link;
//}
}


Expand All @@ -1264,8 +1266,11 @@ public async Task HandleItemDroppedAsync(ItemDroppedEventArgs args)
await HandleLocationItemDroppedAsync(locationItem, args);
else if (args.DropTarget is DriveItem driveItem)
await HandleDriveItemDroppedAsync(driveItem, args);
else if (args.DropTarget is FileTagItem fileTagItem)
await HandleTagItemDroppedAsync(fileTagItem, args);

// Comment out the code for dropping to Tags section as it is currently not supported.

//else if (args.DropTarget is FileTagItem fileTagItem)
// await HandleTagItemDroppedAsync(fileTagItem, args);
}

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

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