Skip to content

Conversation

@Krytan
Copy link
Contributor

@Krytan Krytan commented Jun 5, 2024

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Closes #8282

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

1 - Open Files app
2 - Go to Home
3 - Scroll down to Recent files
4 - Dragging files should be possible

How does dragging work?

Dragging recent files to other programs or outside Files will trigger "copy" similar to windows File explorer, drags files to the desired location without changing the main path.

Dragging recent files inside the app Files will trigger "Move to", drags files to the desired location changing the main path to the new desired path, similar to when dragging files from Documents or Downloads.
file explorer uses "Copy" instead of "Move to" for this.

I can change to copy as well if it makes more sense.

@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Jun 5, 2024
Krytan and others added 6 commits June 5, 2024 15:54
Removed using Microsoft.Extensions.Logging since not using

Co-authored-by: Lukáš Laštůvka <84145589+XTorLukas@users.noreply.github.com>
added Lambda expressions

Co-authored-by: Lukáš Laštůvka <84145589+XTorLukas@users.noreply.github.com>
Co-authored-by: Lukáš Laštůvka <84145589+XTorLukas@users.noreply.github.com>
Lambda expressions

Co-authored-by: Lukáš Laštůvka <84145589+XTorLukas@users.noreply.github.com>
Removed a function that was not necessary
CanDragItems="True" can be applied here
@Krytan Krytan requested review from XTorLukas and yaira2 June 5, 2024 14:36
Copy link
Contributor

@XTorLukas XTorLukas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Krytan and others added 2 commits June 5, 2024 19:13
Co-authored-by: Lukáš Laštůvka <84145589+XTorLukas@users.noreply.github.com>
Co-authored-by: Lukáš Laštůvka <84145589+XTorLukas@users.noreply.github.com>
@yaira2
Copy link
Member

yaira2 commented Jun 5, 2024

I'm trying to drag some text files into Notepad and while they can be dragged, dropping them into Notepad isn't opening the file.

@Krytan
Copy link
Contributor Author

Krytan commented Jun 5, 2024

Interesting, I will try to simulate that, I know that it works with google drive the web version

Copy link
Member

@hishitetsu hishitetsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be possible to perform operations other than copying? Ideally, the process should be common to this.

public async Task DragOverAsync(DragEventArgs e)

@hishitetsu
Copy link
Member

I'm trying to drag some text files into Notepad and while they can be dragged, dropping them into Notepad isn't opening the file.

That is a known issue. It would be great if we could fix it. #11735

@Krytan
Copy link
Contributor Author

Krytan commented Jun 5, 2024

@hishitetsu Correct I checked with downloads and documents and they don't work when copying to notepad or text editor applications as well but I found I way to fix this

@Krytan
Copy link
Contributor Author

Krytan commented Jun 5, 2024

@yaira2 @hishitetsu dragging text files into Notepad or any text editor should work now for recent files

@Krytan
Copy link
Contributor Author

Krytan commented Jun 6, 2024

Shouldn't it be possible to perform operations other than copying? Ideally, the process should be common to this.

public async Task DragOverAsync(DragEventArgs e)

What other operations you got in mind? I believe the reason windows file explorer only uses copy for recent files is because recent files contain multiple files or folders from different paths/directories, so in case an accident happen the user is just copying and never messing with the original path/directory.

@Krytan
Copy link
Contributor Author

Krytan commented Jun 8, 2024

@hishitetsu added limit for reading text file to 50 mb, and added a new method for ReadFileContent, felt that there was many ifs in one section.

Copy link
Member

@hishitetsu hishitetsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found that it inserts text into the already open tab rather than newly opening the dragged file when dragging a file into Notepad. I'll wait for @yaira2 to decide if this is fine.

@hishitetsu
Copy link
Member

I have also found that I can't drag from recent files on the home page in Explorer to Notepad, even though I can drag from normal folders. So, I guess WinUI 3 doesn't support dragging files to Notepad.

Co-authored-by: hishitetsu <66369541+hishitetsu@users.noreply.github.com>
@Krytan
Copy link
Contributor Author

Krytan commented Jun 9, 2024

I have found that it inserts text into the already open tab rather than newly opening the dragged file when dragging a file into Notepad. I'll wait for @yaira2 to decide if this is fine.

That's correct and is not the expected behavior. the expected behavior is to open the file into notepad with the text on the tab. righter than creating a new file.

@Krytan
Copy link
Contributor Author

Krytan commented Jun 9, 2024

I have also found that I can't drag from recent files on the home page in Explorer to Notepad, even though I can drag from normal folders. So, I guess WinUI 3 doesn't support dragging files to Notepad.

Correct. explorer doesn't let dragging from recent files to text editor applications. whenever WinUI 3 dosen't support it I am not so sure.

@hishitetsu
Copy link
Member

The only problem now with this PR is drag-and-drop to Notepad. I think it would be better to delete those codes so that this PR can be merged.

@Krytan
Copy link
Contributor Author

Krytan commented Jun 18, 2024

I agree since dragging to notepad doesn't work anywhere else in the program and no helpful source was found. so one step at time.

@Krytan
Copy link
Contributor Author

Krytan commented Jun 18, 2024

Deleted text to be dropped into text editor for example notepad because of an unexpected issue causing the texteditor to open a new file instead of editing in the same file. moreover FileExplorer also doesn't allow Recent files to drop text into notepad or texteditor apps.

Copy link
Member

@hishitetsu hishitetsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a new problem. When dropping on the desktop I can only copy or link, but when dropping on the sidebar I can move the item.

Krytan and others added 2 commits June 20, 2024 13:15
Co-authored-by: hishitetsu <66369541+hishitetsu@users.noreply.github.com>
@Krytan
Copy link
Contributor Author

Krytan commented Jun 20, 2024

@hishitetsu I see it is because the SideBar also have a drag code that changes the operation to move hmmm to fix this a solution would be in the sidebar.cs add a if estatment that if the file is coming from recent, change the operation to copy

@hishitetsu
Copy link
Member

@hishitetsu I see it is because the SideBar also have a drag code that changes the operation to move hmmm to fix this a solution would be in the sidebar.cs add a if estatment that if the file is coming from recent, change the operation to copy

I agree.

@0x5bfa 0x5bfa added changes requested Changes are needed for this pull request and removed ready for review Pull requests that are ready for review labels Jun 28, 2024
@yaira2
Copy link
Member

yaira2 commented Jul 9, 2024

What's the status of this PR, ready for merge?

@hishitetsu
Copy link
Member

This issue hasn't been fixed. #15555 (review)

@yaira2
Copy link
Member

yaira2 commented Aug 26, 2024

I found a new problem. When dropping on the desktop I can only copy or link, but when dropping on the sidebar I can move the item.

@Krytan are you still planning to work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes requested Changes are needed for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add support for dragging recent files

5 participants