mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:12:44 +00:00 
			
		
		
		
	FileManager+LibGUI: Allow drop on entire DirectoryView
Previously, drag and drop would only work when dragging between node items on a DirectoryView. This commit makes it possible to drag files to the empty area of the DirectoryView and copy files more easily between windows.
This commit is contained in:
		
							parent
							
								
									27091d05ee
								
							
						
					
					
						commit
						e0a16f8752
					
				
					 2 changed files with 3 additions and 5 deletions
				
			
		|  | @ -669,8 +669,6 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio | |||
|     }; | ||||
| 
 | ||||
|     directory_view.on_drop = [&](const GUI::AbstractView&, const GUI::ModelIndex& index, const GUI::DropEvent& event) { | ||||
|         if (!index.is_valid()) | ||||
|             return; | ||||
|         if (!event.mime_data().has_urls()) | ||||
|             return; | ||||
|         auto urls = event.mime_data().urls(); | ||||
|  | @ -690,6 +688,9 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio | |||
|                 target_node.full_path(directory_view.model()).characters(), | ||||
|                 FileSystemPath(url_to_copy.path()).basename().characters()); | ||||
| 
 | ||||
|             if (url_to_copy.path() == new_path) | ||||
|                 continue; | ||||
| 
 | ||||
|             if (!FileUtils::copy_file_or_directory(url_to_copy.path(), new_path)) { | ||||
|                 auto error_message = String::format("Could not copy %s into %s.", | ||||
|                     url_to_copy.to_string().characters(), | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 angel
						angel